예제 #1
0
 /**
  * {@inheritDoc}
  */
 public function setUp()
 {
     $this->serviceManager = Bootstrap::getServiceManager();
     $this->entityManager = $this->serviceManager->get('Doctrine\\ORM\\EntityManager');
     $this->programService = new ProgramService();
     $this->programService->setServiceLocator($this->serviceManager);
 }
예제 #2
0
 /**
  * {@inheritDoc}
  */
 public function setUp()
 {
     $this->serviceManager = Bootstrap::getServiceManager();
     $this->doa = new Doa();
     $this->doa->setId(1);
     $program = new Program();
     $program->setId(1);
     $program->setProgram('Program');
     $this->doa->setProgram($program);
     $organisation = new Organisation();
     $organisation->setId(1);
     $organisation->setOrganisation("Organisation");
     $this->doa->setOrganisation($organisation);
     $this->authorizeService = $this->serviceManager->get('BjyAuthorize\\Service\\Authorize');
     if (!$this->authorizeService->getAcl()->hasResource($this->doa)) {
         $this->authorizeService->getAcl()->addResource($this->doa);
         $this->authorizeService->getAcl()->allow([], $this->doa, []);
     }
     /**
      * Add the resource on the fly
      */
     if (!$this->authorizeService->getAcl()->hasResource(new Doa())) {
         $this->authorizeService->getAcl()->addResource(new Doa());
     }
     $this->authorizeService->getAcl()->allow([], new Doa(), []);
     $this->doaLink = $this->serviceManager->get('viewhelpermanager')->get('programDoaLink');
     /**
      * Bootstrap the application to have the other information available
      */
     $application = $this->serviceManager->get('application');
     $application->bootstrap();
 }
예제 #3
0
 /**
  * {@inheritDoc}
  */
 public function setUp()
 {
     $this->serviceManager = Bootstrap::getServiceManager();
     $this->call = new Call();
     $this->call->setId(1);
     $this->call->setCall('This is the call');
     $program = new Program();
     $program->setProgram('This is the program');
     $this->call->setProgram($program);
     $this->authorizeService = $this->serviceManager->get('BjyAuthorize\\Service\\Authorize');
     if (!$this->authorizeService->getAcl()->hasResource($this->call)) {
         $this->authorizeService->getAcl()->addResource($this->call);
         $this->authorizeService->getAcl()->allow([], $this->call, []);
     }
     /**
      * Add the resource on the fly
      */
     if (!$this->authorizeService->getAcl()->hasResource(new Call())) {
         $this->authorizeService->getAcl()->addResource(new Call());
     }
     $this->authorizeService->getAcl()->allow([], new Call(), []);
     $this->callLink = $this->serviceManager->get('viewhelpermanager')->get('calllink');
     /**
      * Bootstrap the application to have the other information available
      */
     $application = $this->serviceManager->get('application');
     $application->bootstrap();
 }
예제 #4
0
 /**
  * {@inheritDoc}
  */
 public function setUp()
 {
     $this->serviceManager = Bootstrap::getServiceManager();
     $this->entityManager = $this->serviceManager->get('doctrine.entitymanager.orm_default');
     $this->programService = new ProgramService();
     $this->programService->setServiceLocator($this->serviceManager);
 }
예제 #5
0
 /**
  * {@inheritDoc}
  */
 public function setUp()
 {
     $this->serviceManager = Bootstrap::getServiceManager();
     $this->program = new Program();
     $this->program->setId(1);
     $this->program->setProgram('This is the program');
     $this->authorizeService = $this->serviceManager->get('BjyAuthorize\\Service\\Authorize');
     if (!$this->authorizeService->getAcl()->hasResource($this->program)) {
         $this->authorizeService->getAcl()->addResource($this->program);
         $this->authorizeService->getAcl()->allow([], $this->program, []);
     }
     /**
      * Add the resource on the fly
      */
     if (!$this->authorizeService->getAcl()->hasResource(new Program())) {
         $this->authorizeService->getAcl()->addResource(new Program());
     }
     $this->authorizeService->getAcl()->allow([], new Program(), []);
     $this->programLink = $this->serviceManager->get('viewhelpermanager')->get('programlink');
     $routeMatch = new RouteMatch(['program' => 1]);
     $routeMatch->setMatchedRouteName('route-program_entity_program');
     $this->programLink->setRouteMatch($routeMatch);
     /**
      * Bootstrap the application to have the other information available
      */
     $application = $this->serviceManager->get('application');
     $application->bootstrap();
 }
예제 #6
0
 /**
  * {@inheritDoc}
  */
 public function setUp()
 {
     $this->serviceManager = Bootstrap::getServiceManager();
     $this->entityManager = $this->serviceManager->get('Doctrine\\ORM\\EntityManager');
     $this->roadmapData = ['roadmap' => 2, 'dateReleased' => new \DateTime(), 'description' => 'This is the first roadmap'];
     $this->roadmap = new Roadmap();
 }
예제 #7
0
 /**
  * {@inheritDoc}
  */
 public function setUp()
 {
     $this->serviceManager = Bootstrap::getServiceManager();
     $this->entityManager = $this->serviceManager->get('doctrine.entitymanager.orm_default');
     $roadmap = $this->entityManager->find("Program\\Entity\\Roadmap", 1);
     $this->domainData = ['domain' => 'ITEA2', 'roadmap' => $roadmap, 'description' => 'This is a second description', 'color' => '#abcdef', 'mainId' => '2'];
     $this->domain = new Domain();
 }
예제 #8
0
 /**
  * {@inheritDoc}
  */
 public function setUp()
 {
     $serviceManager = Bootstrap::getServiceManager();
     $serviceManager->setAllowOverride(true);
     /** Mock the contactService */
     $contactServiceMock = $this->getMockBuilder('ZfcTwigRenderer')->disableOriginalConstructor()->getMock();
     /** @var \PHPUnit_Framework_MockObject_MockObject $organisationServiceMock */
     $contactServiceMock->expects($this->any())->method('render()')->will($this->returnValue('Test'));
     $serviceManager->setService('ZfcTwigRenderer', $contactServiceMock);
     $serviceManager = Bootstrap::getServiceManager();
     $serviceManager->setAllowOverride(true);
     $contactService = new ContactService();
     /** @var \PHPUnit_Framework_MockObject_MockObject $organisationServiceMock */
     $serviceManager->setService('contact_contact_service', $contactService);
     $this->serviceManager = $serviceManager;
 }
예제 #9
0
 /**
  * {@inheritDoc}
  */
 public function setUp()
 {
     $this->serviceManager = Bootstrap::getServiceManager();
     $this->nda = new Nda();
     $this->nda->setId(1);
     $contact = new Contact();
     $contact->setId(1234);
     $this->nda->setContact($contact);
     $program = new Program();
     $program->setId(1);
     $program->setProgram('Program');
     $call = new Call();
     $call->setId(1);
     $call->setCall("Call");
     $call->setProgram($program);
     $this->nda->setCall(new ArrayCollection([$call]));
     $this->ndaLink = $this->serviceManager->get('viewhelpermanager')->get('ndaLink');
     /**
      * Bootstrap the application to have the other information available
      */
     $application = $this->serviceManager->get('application');
     $application->bootstrap();
 }
예제 #10
0
 /**
  * {@inheritDoc}
  */
 public function setUp()
 {
     $this->serviceManager = Bootstrap::getServiceManager();
 }
예제 #11
0
 /**
  * {@inheritDoc}
  */
 public function setUp()
 {
     $this->serviceManager = Bootstrap::getServiceManager();
     $this->entityManager = $this->serviceManager->get('Doctrine\\ORM\\EntityManager');
 }
예제 #12
0
 /**
  * {@inheritDoc}
  */
 public function setUp()
 {
     $this->serviceManager = Bootstrap::getServiceManager();
     $this->entityManager = $this->serviceManager->get('doctrine.entitymanager.orm_default');
 }
예제 #13
0
        return $dir . '/' . $path;
    }
    protected static function initAutoloader()
    {
        $vendorPath = static::findParentPath('vendor');
        $zf2Path = getenv('ZF2_PATH');
        if (!$zf2Path) {
            if (defined('ZF2_PATH')) {
                $zf2Path = ZF2_PATH;
            } elseif (is_dir($vendorPath . '/ZF2/library')) {
                $zf2Path = $vendorPath . '/ZF2/library';
            } elseif (is_dir($vendorPath . '/zendframework/zendframework/library')) {
                $zf2Path = $vendorPath . '/zendframework/zendframework/library';
            }
        }
        if (!$zf2Path) {
            throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install` or define a ZF2_PATH environment variable.');
        }
        if (file_exists($vendorPath . '/autoload.php')) {
            include $vendorPath . '/autoload.php';
        }
        include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
        AutoloaderFactory::factory(['Zend\\Loader\\StandardAutoloader' => ['autoregister_zf' => true, 'namespaces' => [__NAMESPACE__ => __DIR__ . '/' . __NAMESPACE__, 'Admin' => __DIR__ . '/../../../../module/Admin']]]);
    }
    public static function getServiceManager()
    {
        return static::$serviceManager;
    }
}
Bootstrap::init();
예제 #14
0
        $rootPath = dirname(static::findParentPath('module'));
        chdir($rootPath);
    }
    protected static function initAutoloader()
    {
        $vendorPath = static::findParentPath('vendor');
        if (file_exists($vendorPath . '/autoload.php')) {
            include $vendorPath . '/autoload.php';
        }
        if (!class_exists('Zend\\Loader\\AutoloaderFactory')) {
            throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install`');
        }
        AutoloaderFactory::factory(['Zend\\Loader\\StandardAutoloader' => ['autoregister_zf' => true, 'namespaces' => [__NAMESPACE__ => __DIR__ . '/' . __NAMESPACE__]]]);
    }
    protected static function findParentPath($path)
    {
        $dir = __DIR__;
        $previousDir = '.';
        while (!is_dir($dir . '/' . $path)) {
            $dir = dirname($dir);
            if ($previousDir === $dir) {
                return false;
            }
            $previousDir = $dir;
        }
        return $dir . '/' . $path;
    }
}
Bootstrap::init();
Bootstrap::chroot();