Exemplo n.º 1
0
 public function testCanResetInstance()
 {
     $original = StaticEventManager::getInstance();
     StaticEventManager::resetInstance();
     $test = StaticEventManager::getInstance();
     $this->assertNotSame($original, $test);
 }
Exemplo n.º 2
0
 public function setUp()
 {
     StaticEventManager::resetInstance();
     if (isset($this->message)) {
         unset($this->message);
     }
     $this->events = new EventManager();
 }
Exemplo n.º 3
0
 public function setUp()
 {
     $this->controller = new TestAsset\RestfulTestController();
     $this->request = new Request();
     $this->routeMatch = new RouteMatch(array('controller' => 'controller-restful'));
     $this->event = new MvcEvent();
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
     StaticEventManager::resetInstance();
 }
 public function setUp()
 {
     StaticEventManager::resetInstance();
     $this->controller = new TestAsset\SampleController();
     $this->request = new Request();
     $this->response = null;
     $this->routeMatch = new RouteMatch(array('controller' => 'controller-sample'));
     $this->event = new MvcEvent();
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
 }
 public function setUp()
 {
     StaticEventManager::resetInstance();
     $this->controller = new IndexController();
     $this->request = new Request();
     $this->response = null;
     $this->routeMatch = new RouteMatch(array('controller' => 'php-unit-controller-index'));
     $this->event = new MvcEvent();
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
 }
Exemplo n.º 6
0
 public function _after(\Codeception\TestCase $test)
 {
     $_SESSION = array();
     $_GET = array();
     $_POST = array();
     $_COOKIE = array();
     // reset singleton
     StaticEventManager::resetInstance();
     Placeholder\Registry::unsetRegistry();
     $this->queries = 0;
     $this->time = 0;
 }
Exemplo n.º 7
0
 public function _after(\Codeception\TestCase $test)
 {
     $_SESSION = array();
     $_GET = array();
     $_POST = array();
     $_COOKIE = array();
     // reset singleton
     StaticEventManager::resetInstance();
     // Reset singleton placeholder if version < 2.2.0, no longer required in 2.2.0+
     if (Version::compareVersion('2.2.0') >= 0) {
         Placeholder\Registry::unsetRegistry();
     }
     $this->queries = 0;
     $this->time = 0;
 }
Exemplo n.º 8
0
 public function _after(\Codeception\TestCase $test)
 {
     $_SESSION = [];
     $_GET = [];
     $_POST = [];
     $_COOKIE = [];
     // reset singleton
     StaticEventManager::resetInstance();
     // Reset singleton placeholder if version < 2.2.0, no longer required in 2.2.0+
     if (Version::compareVersion('2.2.0') >= 0) {
         Placeholder\Registry::unsetRegistry();
     }
     //Close the session, if any are open
     if (session_status() == PHP_SESSION_ACTIVE) {
         session_write_close();
     }
     $this->queries = 0;
     $this->time = 0;
 }
 protected function setUp()
 {
     StaticEventManager::resetInstance();
     $this->serviceManager = new ServiceManager();
     $this->request = new Request();
     $this->routeMatch = new RouteMatch(array('controller' => 'HtUserRegistration'));
     $this->event = new MvcEvent();
     $this->event->setRouteMatch($this->routeMatch);
     $this->zfcUserMapper = $this->getMock('ZfcUser\\Mapper\\User');
     $this->zfcUserEntity = $this->getMock('ZfcUser\\Entity\\UserInterface');
     $this->userRegistrationService = $this->getMock('HtUserRegistration\\Service\\UserRegistrationServiceInterface');
     $this->userRegistrationMapper = $this->getMock('HtUserRegistration\\Mapper\\UserRegistrationMapperInterface');
     $this->userRegistrationEntity = $this->getMock('HtUserRegistration\\Entity\\UserRegistrationInterface');
     $this->moduleOptions = $this->getMock('HtUserRegistration\\Options\\ModuleOptions');
     $this->moduleOptions->expects($this->any())->method('getPostVerificationRoute')->willReturn($this->redirectRoute);
     $routeStack = new SimpleRouteStack();
     $route = new Segment($this->redirectRoute);
     $routeStack->addRoute($this->redirectRoute, $route);
     $this->event->setRouter($routeStack);
     $this->serviceManager->setService('HtUserRegistration\\ModuleOptions', $this->moduleOptions);
     $this->controller = new UserRegistrationController($this->userRegistrationService);
     $this->controller->setServiceLocator($this->serviceManager);
     $this->controller->setEvent($this->event);
 }
Exemplo n.º 10
0
 public function testDoesNotCreateStaticInstanceIfNonePresent()
 {
     StaticEventManager::resetInstance();
     $this->assertFalse($this->events->getSharedManager());
 }
Exemplo n.º 11
0
 public function tearDown()
 {
     StaticEventManager::resetInstance();
 }
Exemplo n.º 12
0
<?php

include_once __DIR__ . '/vendor/autoload.php';
$appConfig = $appConfig = array('modules' => array(), 'module_listener_options' => array('module_paths' => array('./vendor'), 'config_glob_paths' => array('config/autoload/{,*.}{global,local}.php')));
if (!is_dir(__DIR__ . '/trace')) {
    mkdir(__DIR__ . '/trace');
}
ini_set('xdebug.show_mem_delta', '1');
for ($t = 0; $t < 5; $t++) {
    xdebug_start_trace(sprintf('%s/trace/%d', __DIR__, $t + 1));
    $app = \Zend\Mvc\Application::init($appConfig);
    xdebug_stop_trace();
    \Zend\EventManager\StaticEventManager::resetInstance();
    $app = null;
}
 /**
  * Reset the request
  *
  * @return AbstractControllerTestCase
  */
 public function reset($keepPersistence = false)
 {
     // force to re-create all components
     $this->application = null;
     // reset server datas
     if (!$keepPersistence) {
         $_SESSION = [];
         $_COOKIE = [];
     }
     $_GET = [];
     $_POST = [];
     // reset singleton
     StaticEventManager::resetInstance();
     return $this;
 }
Exemplo n.º 14
0
 public function setUp()
 {
     StaticEventManager::resetInstance();
 }
Exemplo n.º 15
0
 /**
  * Reset the request
  *
  * @return AbstractControllerTestCase
  */
 public function reset()
 {
     // force to re-create all components
     $this->application = null;
     // reset server datas
     $_SESSION = array();
     $_GET = array();
     $_POST = array();
     $_COOKIE = array();
     // reset singleton
     StaticEventManager::resetInstance();
     return $this;
 }
Exemplo n.º 16
0
 public function _after(TestInterface $test)
 {
     $_SESSION = [];
     $_GET = [];
     $_POST = [];
     $_COOKIE = [];
     if (class_exists('Zend\\EventManager\\StaticEventManager')) {
         // reset singleton (ZF2)
         StaticEventManager::resetInstance();
     }
     //Close the session, if any are open
     if (session_status() == PHP_SESSION_ACTIVE) {
         session_write_close();
     }
     $this->queries = 0;
     $this->time = 0;
     parent::_after($test);
 }
 public function tearDown()
 {
     // Need to do this to ensure other tests in suite do not get state
     StaticEventManager::resetInstance();
 }
 /**
  * Reset the request
  *
  * @return AbstractControllerTestCase
  */
 public function reset($keepPersistence = false)
 {
     // force to re-create all components
     $this->application = null;
     // reset server data
     if (!$keepPersistence) {
         // Do not create a global session variable if it doesn't already
         // exist. Otherwise calling this function could mark tests risky,
         // as it changes global state.
         if (array_key_exists('_SESSION', $GLOBALS)) {
             $_SESSION = [];
         }
         $_COOKIE = [];
     }
     $_GET = [];
     $_POST = [];
     // reset singleton
     if (class_exists(StaticEventManager::class)) {
         StaticEventManager::resetInstance();
     }
     return $this;
 }