public function testCanResetInstance() { $original = StaticEventManager::getInstance(); StaticEventManager::resetInstance(); $test = StaticEventManager::getInstance(); $this->assertNotSame($original, $test); }
public function setUp() { StaticEventManager::resetInstance(); if (isset($this->message)) { unset($this->message); } $this->events = new EventManager(); }
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); }
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; }
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; }
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); }
public function testDoesNotCreateStaticInstanceIfNonePresent() { StaticEventManager::resetInstance(); $this->assertFalse($this->events->getSharedManager()); }
public function tearDown() { StaticEventManager::resetInstance(); }
<?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; }
public function setUp() { StaticEventManager::resetInstance(); }
/** * 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; }
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; }