On Mon, Oct 26, 2009 at 5:06 PM, prodigitalson <[email protected]>wrote:

>
> Well first off you shouldnt really throw exceptions in your test... thats
> what the assertions are for really for example:
>
> function testAclPluginLoadsIfUserIsAuthenticated() {
>
>        $this->loginDavid(); // tested independently and known to work
>        $this->resetRequest()->resetResponse();
>        $this->dispatch('/admin/index');
>        $auth = Zend_Auth::getInstance();
>         $this->assertTrue($auth->hasIdentity());
>        $this->assertEquals('david', $auth->getStorage()->read()->username);
>
>  $this->assertType('Plugin_Acl',$front->getPlugin('Plugin_Acl'),"Plugin_Acl
> not loaded when it should be");
> }
>
> If you do it this way youll get more meaningful output from PHP unit. Which
> brings us to the key question... Where exactly in the test you provided (or
> my modified version) is it failing?
>
>
Um, it's sort of moot now, because the frustration with the tests got me
thinking about my code organization, and I decided to collapse my
authentication and ACL into a single plugin. But the preDispatch() does not
instantiate my Model_Acl unless there is an authenticated user. It has the
efficiency of what I was attempting before, and then some, while not
presenting any testing problems (yet).

But I take your point about the exception. Although the method is tested
elsewhere and so  I figured if it fails here, abort the test run and fix the
problem.But -- still learning.

Many thanks.

-- 
Demand health care for everyone:
http://mobilizeforhealthcare.org/

--
David Mintz
http://davidmintz.org/

Reply via email to