Inheritance: extends Zend\EventManager\SharedEventManager
Beispiel #1
0
 /**
  * Test
  *
  * @return void
  */
 public function testOnBootstrap()
 {
     $this->assertTrue($this->object->install());
     $this->assertTrue($this->object->update('0.1.0'));
     $this->assertNull($this->object->onBootstrap(Registry::get('Application')->getMvcEvent()));
     $this->assertTrue($this->object->uninstall());
     StaticEventManager::resetInstance();
 }
Beispiel #2
0
 /**
  * Tears down the fixture, for example, closes a network connection.
  * This method is called after a test is executed.
  *
  * @return void
  */
 public function tearDown()
 {
     StaticEventManager::resetInstance();
     ModuleModel::uninstall(Registry::get('Application')->getServiceManager()->get('CustomModules')->getModule('Social'), ModuleModel::fromName('Social'));
     parent::tearDown();
 }
Beispiel #3
0
 /**
  * Tears down the fixture, for example, closes a network connection.
  * This method is called after a test is executed.
  *
  * @return void
  */
 protected function tearDown()
 {
     $this->document->delete();
     $this->documentType->delete();
     $this->user->delete();
     $this->layout->delete();
     $this->view->delete();
     unset($this->document);
     unset($this->documentType);
     unset($this->user);
     unset($this->layout);
     unset($this->view);
     unset($this->object);
     StaticEventManager::resetInstance();
     if (file_exists($this->filePath)) {
         unlink($this->filePath);
     }
 }
Beispiel #4
0
 /**
  * Retrieve event manager
  *
  * @return \Gc\Event\StaticEventManager
  */
 public function events()
 {
     return StaticEventManager::getInstance();
 }
Beispiel #5
0
 /**
  * Tears down the fixture, for example, closes a network connection.
  * This method is called after a test is executed.
  *
  * @return void
  */
 public function tearDown()
 {
     StaticEventManager::resetInstance();
     ModuleModel::uninstall(Registry::get('Application')->getServiceManager()->get('CustomModules')->getModule('Blog'), ModuleModel::fromName('Blog'));
     $this->document->delete();
     $this->view->delete();
     $this->layout->delete();
     $this->documentType->delete();
     unset($this->document);
     unset($this->object);
     unset($this->view);
     unset($this->layout);
     unset($this->documentType);
     parent::tearDown();
 }
Beispiel #6
0
    } else {
        include $zfPath . '/Zend/Loader/AutoloaderFactory.php';
        \Zend\Loader\AutoloaderFactory::factory(array('Zend\\Loader\\StandardAutoloader' => $configuration['autoloader']));
    }
}
if (!class_exists('Zend\\Loader\\AutoloaderFactory')) {
    throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install` ' . 'or define a ZF2_PATH environment variable.');
}
/*
 * Load the user-defined test configuration file, if it exists; otherwise, load
 * the default configuration.
 */
if (is_readable($gcTests . DIRECTORY_SEPARATOR . 'TestConfiguration.php')) {
    include_once $gcTests . DIRECTORY_SEPARATOR . 'TestConfiguration.php';
} else {
    include_once $gcTests . DIRECTORY_SEPARATOR . 'TestConfiguration.php.dist';
}
require_once 'config/prepare-database.php';
require_once 'config/override-php-functions.php';
// Run application
\Zend\Console\Console::overrideIsConsole(false);
$application = \Zend\Mvc\Application::init($configuration);
$application->getMvcEvent()->getRouter()->setRequestUri($application->getRequest()->getUri());
$application->getRequest()->setBasePath('http://got-cms.com');
\Gc\Registry::set('Application', $application);
//Remove all event observer
\Gc\Event\StaticEventManager::resetInstance();
/*
 * Unset global variables that are no longer needed.
 */
unset($gcRoot, $gcDocumentRoot, $gcLibrary, $gcTests, $path);