Skip to content
Snippets Groups Projects
Select Git revision
  • ef057002483c28e8a2d7e8dd3deeaf88e96c17d3
  • master default protected
  • release-1.3.10
  • popover-bootstrap-3.4
  • zf-3.x
  • 3.0.9
  • 3.0.8
  • 1.3.10
  • 3.0.7
  • 3.0.6
  • 3.0.5
  • 3.0.4
  • 3.0.3
  • 3.0.2
  • 3.0.1
  • 3.0.0
  • 1.3.9
  • 1.3.8
  • 1.3.7
  • 1.3.6
  • 1.3.5
  • 1.3.4
  • 1.3.3
  • 1.3.2
  • 1.3.1
25 results

schema_oracle.sql

Blame
  • Forked from lib / unicaen / auth
    Source project has a limited visibility.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    AbstractControllerTestCase.php 3.05 KiB
    <?php
    
    namespace UnicaenTest\Controller;
    
    use Doctrine\ORM\EntityManager;
    use Prophecy\Argument;
    use Prophecy\Prophecy\ObjectProphecy;
    use Prophecy\Prophet;
    use Zend\ServiceManager\ServiceManager;
    use Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase;
    
    /**
     * Class AbstractControllerTest
     *
     * @package ApplicationTest\Controller
     */
    abstract class AbstractControllerTestCase extends AbstractHttpControllerTestCase
    {
    //    public function setUp()
    //    {
    //        // The module configuration should still be applicable for tests.
    //        // You can override configuration here with test case specific values,
    //        // such as sample view templates, path stacks, module_listener_options,
    //        // etc.
    //        $configOverrides = [];
    //
    //        $this->setApplicationConfig(ArrayUtils::merge(
    //            // Grabbing the full application configuration:
    //            include __DIR__ . '/../../../../config/application.config.php',
    //            $configOverrides
    //        ));
    //
    //        parent::setUp();
    //    }
    
        /**
         * @param string $authorizeServiceClass
         * @return ObjectProphecy|UnicaenAuth\Service\AuthorizeService
         */
        protected function mockAuthorizeService($authorizeServiceClass)
        {
            $prophet = new Prophet();
    
            /** @var ObjectProphecy|UnicaenAuth\Service\AuthorizeService $prophecy */
            $prophecy = $prophet->prophesize();
            $prophecy->willExtend($authorizeServiceClass);
    
            $service = $prophecy->reveal();
    
            /* @var $services ServiceManager */
            $services = $this->getApplication()->getServiceManager();
            $services->setAllowOverride(true);
            $services->setFactory('BjyAuthorize\Service\Authorize', function() use ($service) {
                return $service;
            });
    
            return $prophecy;
        }
    
        /**
         * @param string $userContextServiceClass
         * @return ObjectProphecy|UnicaenAuth\Service\UserContext
         */
        protected function mockUserContextService($userContextServiceClass)
        {
            $prophet = new Prophet();
    
            /** @var ObjectProphecy|UnicaenAuth\Service\UserContext $prophecy */
            $prophecy = $prophet->prophesize();
            $prophecy->willExtend($userContextServiceClass);
    
            $prophecy->getEventManager()->willReturn($this->getApplication()->getEventManager());
            $prophecy->setServiceLocator(Argument::any())->willReturn();
    
            $service = $prophecy->reveal();
    
            /* @var $services ServiceManager */
            $services = $this->getApplication()->getServiceManager();
            $services->setAllowOverride(true);
            $services->setFactory('UnicaenAuth\Service\UserContext', function() use ($service) {
                return $service;
            });
    
            return $prophecy;
        }
    
        /**
         * @var EntityManager
         */
        private $em;
    
        /**
         * @param string $name
         * @return EntityManager
         */
        protected function em($name = 'orm_default')
        {
            if (null === $this->em) {
                $this->em = $this->getApplicationServiceLocator()->get("doctrine.entitymanager.$name");
            }
    
            return $this->em;
        }
    }