Commit 3591a585 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Amélioration.

parent 9ab37f67
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -4,7 +4,11 @@ namespace UnicaenTest\Controller;

use Doctrine\ORM\EntityManager;
use Prophecy\Argument;
use Prophecy\Prophecy\ObjectProphecy;
use Prophecy\Prophet;
use UnicaenAuth\Service\AuthorizeService;
use UnicaenAuth\Service\UserContext as UserContextService;
use Zend\ServiceManager\ServiceManager;
use Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase;

/**
@@ -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) {
@@ -55,11 +61,13 @@ abstract class AbstractControllerTestCase extends AbstractHttpControllerTestCase

    /**
     * @param string $userContextServiceClass
     * @return \Prophecy\Prophecy\ObjectProphecy
     * @return ObjectProphecy|UserContextService
     */
    protected function mockUserContextService($userContextServiceClass)
    {
        $prophet = new Prophet();

        /** @var ObjectProphecy|UserContextService $prophecy */
        $prophecy = $prophet->prophesize();
        $prophecy->willExtend($userContextServiceClass);

@@ -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) {