Hi, I've had success doing this:

$authorizeMock =
Mockery::mock('BjyAuthorize\Provider\Identity\AuthenticationIdentityProvider');
$authorizeMock->shouldReceive('getIdentityRoles')->andReturn(array('admin'));

$this->getApplicationServiceLocator()->setAllowOverride(true)
     
->setService('BjyAuthorize\Provider\Identity\AuthenticationIdentityProvider',
$authorizeMock);

This lets you mock the identity roles (which is passed to BjyAuthorize to
check if you're allowed to be in there). This is obviously a test case I use
in my admin controller, but I could change that to "guest" or "user" and do
a test that they get a 404 or 302 response code.

Best,
Steve



--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/How-to-PHPUnit-test-a-Controller-under-BjyAuthorize-tp4661333p4661423.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to