public function getServiceConfig() { return array('initializers' => array(function ($instance, $sm) { if ($instance instanceof Service\AuthorizeAwareInterface) { $instance->setAuthorizeService($sm->get('BjyAuthorize\\Service\\Authorize')); } }), 'factories' => array('BjyAuthorize\\Service\\Authorize' => 'BjyAuthorize\\Service\\AuthorizeFactory', 'BjyAuthorize\\Provider\\Identity\\ZfcUserZendDb' => function ($sm) { $adapter = $sm->get('zfcuser_zend_db_adapter'); $provider = new Provider\Identity\ZfcUserZendDb($adapter); $provider->setUserService($sm->get('zfcuser_user_service')); return $provider; }, 'BjyAuthorize\\Provider\\Identity\\ZfcUserDoctrine' => function ($sm) { $em = $sm->get('doctrine.entitymanager.orm_default'); $provider = new Provider\Identity\ZfcUserDoctrine($em); $provider->setUserService($sm->get('zfcuser_user_service')); return $provider; }, 'BjyAuthorize\\View\\UnauthorizedStrategy' => function ($sm) { $template = $sm->get('BjyAuthorize\\Service\\Authorize')->getTemplate(); $strategy = new View\UnauthorizedStrategy(); $strategy->setTemplate($template); return $strategy; }, 'BjyAuthorize\\Provider\\Role\\ZendDb' => function ($sm) { $provider = new Provider\Role\ZendDb(); $provider->setAdapter($sm->get('Zend\\Db\\Adapter\\Adapter')); return $provider; }, 'BjyAuthorize\\Provider\\Role\\Doctrine' => function ($sm) { $provider = new Provider\Role\Doctrine(); return $provider; })); }
/** * @covers \BjyAuthorize\View\UnauthorizedStrategy::setTemplate * @covers \BjyAuthorize\View\UnauthorizedStrategy::getTemplate */ public function testGetSetTemplate() { $this->assertSame('template/name', $this->strategy->getTemplate()); $this->strategy->setTemplate('other/template'); $this->assertSame('other/template', $this->strategy->getTemplate()); }