Loading src/UnicaenTest/Controller/AbstractControllerTestCase.php +12 −4 Original line number Diff line number Diff line Loading @@ -2,9 +2,13 @@ namespace UnicaenTest\Controller; use Application\Service\UserContextService; use Doctrine\ORM\EntityManager; use Prophecy\Argument; use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophet; use UnicaenAuth\Service\AuthorizeService; use Zend\ServiceManager\ServiceManager; use Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase; /** Loading Loading @@ -33,17 +37,19 @@ abstract class AbstractControllerTestCase extends AbstractHttpControllerTestCase /** * @param string $authorizeServiceClass * @return \Prophecy\Prophecy\ObjectProphecy * @return ObjectProphecy|AuthorizeService */ protected function mockAuthorizeService($authorizeServiceClass) { $prophet = new Prophet(); /** @var ObjectProphecy|AuthorizeService $prophecy */ $prophecy = $prophet->prophesize(); $prophecy->willExtend($authorizeServiceClass); $service = $prophecy->reveal(); /* @var $services \Zend\ServiceManager\ServiceManager */ /* @var $services ServiceManager */ $services = $this->getApplication()->getServiceManager(); $services->setAllowOverride(true); $services->setFactory('BjyAuthorize\Service\Authorize', function() use ($service) { Loading @@ -55,11 +61,13 @@ abstract class AbstractControllerTestCase extends AbstractHttpControllerTestCase /** * @param string $userContextServiceClass * @return \Prophecy\Prophecy\ObjectProphecy * @return ObjectProphecy */ protected function mockUserContextService($userContextServiceClass) { $prophet = new Prophet(); /** @var ObjectProphecy|UserContextService $prophecy */ $prophecy = $prophet->prophesize(); $prophecy->willExtend($userContextServiceClass); Loading @@ -68,7 +76,7 @@ abstract class AbstractControllerTestCase extends AbstractHttpControllerTestCase $service = $prophecy->reveal(); /* @var $services \Zend\ServiceManager\ServiceManager */ /* @var $services ServiceManager */ $services = $this->getApplication()->getServiceManager(); $services->setAllowOverride(true); $services->setFactory('UnicaenAuth\Service\UserContext', function() use ($service) { Loading Loading
src/UnicaenTest/Controller/AbstractControllerTestCase.php +12 −4 Original line number Diff line number Diff line Loading @@ -2,9 +2,13 @@ namespace UnicaenTest\Controller; use Application\Service\UserContextService; use Doctrine\ORM\EntityManager; use Prophecy\Argument; use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophet; use UnicaenAuth\Service\AuthorizeService; use Zend\ServiceManager\ServiceManager; use Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase; /** Loading Loading @@ -33,17 +37,19 @@ abstract class AbstractControllerTestCase extends AbstractHttpControllerTestCase /** * @param string $authorizeServiceClass * @return \Prophecy\Prophecy\ObjectProphecy * @return ObjectProphecy|AuthorizeService */ protected function mockAuthorizeService($authorizeServiceClass) { $prophet = new Prophet(); /** @var ObjectProphecy|AuthorizeService $prophecy */ $prophecy = $prophet->prophesize(); $prophecy->willExtend($authorizeServiceClass); $service = $prophecy->reveal(); /* @var $services \Zend\ServiceManager\ServiceManager */ /* @var $services ServiceManager */ $services = $this->getApplication()->getServiceManager(); $services->setAllowOverride(true); $services->setFactory('BjyAuthorize\Service\Authorize', function() use ($service) { Loading @@ -55,11 +61,13 @@ abstract class AbstractControllerTestCase extends AbstractHttpControllerTestCase /** * @param string $userContextServiceClass * @return \Prophecy\Prophecy\ObjectProphecy * @return ObjectProphecy */ protected function mockUserContextService($userContextServiceClass) { $prophet = new Prophet(); /** @var ObjectProphecy|UserContextService $prophecy */ $prophecy = $prophet->prophesize(); $prophecy->willExtend($userContextServiceClass); Loading @@ -68,7 +76,7 @@ abstract class AbstractControllerTestCase extends AbstractHttpControllerTestCase $service = $prophecy->reveal(); /* @var $services \Zend\ServiceManager\ServiceManager */ /* @var $services ServiceManager */ $services = $this->getApplication()->getServiceManager(); $services->setAllowOverride(true); $services->setFactory('UnicaenAuth\Service\UserContext', function() use ($service) { Loading