Exemple #1
0
 /**
  * Runs before each test
  *
  * @return void
  */
 protected function setUp()
 {
     parent::setUp();
     $this->originalDiContainer = Application::getInstance()->getDiContainer();
     $diContainer = new SystemContainer();
     $this->storage = new StorageMock(true, false, array());
     $diContainer->setMiddlewareStorage($this->storage);
     Application::getInstance()->setDiContainer($diContainer);
     Config::getInstance()->set(array('system.project.name' => 'test'));
 }
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     parent::setUp();
     $container = new SystemContainer();
     $container[SystemContainer::KEY_MEMCACHE] = $container->share(function ($container) {
         return new MemcacheMock();
     });
     Application::getInstance()->setDiContainer($container);
     $this->memcacheMock = Application::getInstance()->getDiContainer()->getMemcache();
     Config::getInstance()->set(array('resource.storage.test.host' => 'localhost', 'resource.storage.test.readOnly' => false, 'resource.storage.test2.host' => 'localhost', 'resource.storage.test2.port' => 11222, 'resource.storage.test2.keyPrefix' => 'test.', 'resource.storage.test2.keySuffix' => '.test', 'resource.storage.test3.host' => 'localhost', 'resource.storage.test3.hashKey' => true, 'resource.storage.test3.keyPrefix' => 'test.', 'resource.storage.test4.port' => 11211, 'resource.storage.test5.host' => 'localhost', 'resource.storage.test5.readOnly' => true));
 }
 protected function setUp()
 {
     parent::setUp();
     $this->originalObLevel = ob_get_level();
     $application = Application::getInstance();
     $this->originalDiContainer = $application->getDiContainer();
     $diContainer = new SystemContainer();
     $diContainer->addSearchNamespace(SystemContainer::NAMESPACE_SEARCH_CONTROLLER, '\\YapepBaseTest\\Mock\\Controller');
     $application->setDiContainer($diContainer);
     $application->setI18nTranslator(new TranslatorMock(function ($string, $params) {
         return json_encode(array('string' => $string, 'params' => $params));
     }));
 }
Exemple #4
0
 /**
  * Raises an event if an event with it's type was not yet raised.
  *
  * @param string $eventType   The event type
  *
  * @return void
  */
 protected function raiseEventIfNotRaisedYet($eventType)
 {
     $eventHandlerRegistry = $this->diContainer->getEventHandlerRegistry();
     if (is_null($eventHandlerRegistry->getLastTimeForEventType($eventType))) {
         $eventHandlerRegistry->raise(new Event($eventType));
     }
 }
 /**
  * Tests the getFileResourceHandler() method.
  *
  * @return void
  */
 public function testGetFileResourceHandler()
 {
     $systemContainer = new SystemContainer();
     $systemContainer[SystemContainer::KEY_FILE_RESOURCE_HANDLER] = '\\YapepBaseTest\\Mock\\File\\ResourceHandlerMock';
     $path = 'test';
     $accessType = 2;
     /** @var ResourceHandlerMock $resourceHandler  */
     $resourceHandler = $systemContainer->getFileResourceHandler($path, $accessType);
     $this->assertInstanceOf('\\YapepBaseTest\\Mock\\File\\ResourceHandlerMock', $resourceHandler);
     $this->assertEquals($path, $resourceHandler->path);
     $this->assertEquals($accessType, $resourceHandler->accessType);
 }