public function testHttpAuth() { $this->module->amOnPage('/auth'); $this->module->see('Unauthorized'); $this->module->amHttpAuthenticated('davert', 'password'); $this->module->amOnPage('/auth'); $this->module->dontSee('Unauthorized'); $this->module->see("Welcome, davert"); $this->module->amHttpAuthenticated('davert', '123456'); $this->module->amOnPage('/auth'); $this->module->see('Forbidden'); }
public function _after(\Codeception\TestCase $test) { $_SESSION = array(); $_GET = array(); $_POST = array(); $_COOKIE = array(); parent::_after($test); }
public function _after(TestCase $test) { //Close the session, if any are open if (session_status() == PHP_SESSION_ACTIVE) { session_write_close(); } parent::_after($test); }
/** * Constructor. * * @param ModuleContainer $container * @param null $config */ public function __construct(ModuleContainer $container, $config = null) { $this->config = array_merge(['cleanup' => true, 'unit' => true, 'environment' => 'testing', 'start' => 'bootstrap' . DIRECTORY_SEPARATOR . 'start.php', 'root' => '', 'filters' => false], (array) $config); $projectDir = explode('workbench', Configuration::projectDir())[0]; $projectDir .= $this->config['root']; $this->config['project_dir'] = $projectDir; $this->config['start_file'] = $projectDir . $this->config['start']; parent::__construct($container, null); }
public function _after(TestInterface $test) { parent::_after($test); $_SESSION = []; $_GET = []; $_POST = []; $_FILES = []; $_COOKIE = []; }
public function __construct($config = null) { $this->config = array_merge( array( 'cleanup' => true, 'start' => 'bootstrap' . DIRECTORY_SEPARATOR . 'start.php' ), (array) $config ); parent::__construct(); }
public function _after(TestCase $test) { parent::_after($test); try { $this->container->getByType('Nette\\Http\\Session')->close(); } catch (MissingServiceException $e) { } $_SESSION = []; $_GET = []; $_POST = []; $_FILES = []; $_COOKIE = []; }
public function testMoveBackThrowsExceptionIfNumberOfStepsIsInvalid() { $this->module->amOnPage('/iframe'); $this->module->switchToIframe('content'); $this->module->seeCurrentUrlEquals('/info'); $this->module->click('Ссылочка'); $this->module->seeCurrentUrlEquals('/'); $invalidValues = [0, -5, 1.5, 'a', 3]; foreach ($invalidValues as $invalidValue) { try { $this->module->moveBack($invalidValue); $this->fail('Expected to get exception here'); } catch (\InvalidArgumentException $e) { codecept_debug('Exception: ' . $e->getMessage()); } } }
public function _after(\Codeception\TestCase $test) { $_SESSION = array(); $_FILES = array(); $_GET = array(); $_POST = array(); $_COOKIE = array(); $_REQUEST = array(); if ($this->transaction and $this->config['cleanup']) { $this->transaction->rollback(); } if (Yii::$app) { Yii::$app->session->close(); } parent::_after($test); }
public function __construct($config = null) { $this->config = array_merge(array('cleanup' => true, 'unit' => true, 'environment' => 'testing', 'start' => 'bootstrap' . DIRECTORY_SEPARATOR . 'start.php', 'root' => '', 'filters' => false), (array) $config); parent::__construct(); }
/** * After step hook. * * @param \Codeception\Step $step */ public function _afterStep(\Codeception\Step $step) { \Illuminate\Support\Facades\Facade::clearResolvedInstances(); parent::_afterStep($step); }
protected function getAbsoluteUrlFor($uri) { $uri = str_replace($this->siteUrl, 'http://localhost', str_replace(urlencode($this->siteUrl), urlencode('http://localhost'), $uri)); return parent::getAbsoluteUrlFor($uri); }
public function testExceptionIsThrownOnRedirectToExternalUrl() { $this->setExpectedException('\\Codeception\\Exception\\ExternalUrlException'); $this->module->amOnPage('/external_url'); $this->module->click('Next'); }
/** * After step hook. * * @param \Codeception\Step $step */ public function _afterStep(\Codeception\Step $step) { parent::_afterStep($step); Facade::clearResolvedInstances(); }
public function _after(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) { Registry::unsetRegistry(); } //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 _after(\Codeception\TestCase $test) { $this->kernel->shutdown(); parent::_after($test); }
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 _after(TestCase $test) { $_SESSION = []; $_GET = []; $_POST = []; $_COOKIE = []; if ($this->bootstrap) { $fc = $this->bootstrap->getBootstrap()->getResource('frontcontroller'); if ($fc) { $fc->resetInstance(); } } \Zend_Layout::resetMvcInstance(); \Zend_Controller_Action_HelperBroker::resetHelpers(); \Zend_Session::$_unitTestEnabled = true; $this->queries = 0; $this->time = 0; parent::_after($test); }
public function _after(TestCase $test) { $_SESSION = []; $_GET = []; $_POST = []; $_COOKIE = []; $_REQUEST = []; Yii::app()->session->close(); parent::_after($test); }
protected function proceedSee($text, $selector = null) { $response = $this->browser->getResponse()->getContent(); if ($selector) { $nodes = $this->browser->getResponseDomCssSelector()->matchAll($selector); $values = ''; foreach ($nodes as $node) { $values .= '<!-- Merged Output -->' . trim($node->nodeValue); } $response = Framework::formatResponse($response); return array('pageContains', $text, $values, "'{$selector}' on {$response}"); } $response = Framework::formatResponse($response); return array('pageContains', $text, strip_tags($this->browser->getResponse()->getContent()), "on {$response}."); }
/** * After step hook. * * @param \Codeception\Step $step */ public function _afterStep(Step $step) { parent::_beforeStep($step); $this->app['session.store']->save(); Facade::clearResolvedInstances(); }
public function _after(\Codeception\TestCase $test) { $_SESSION = array(); $_GET = array(); $_POST = array(); $_COOKIE = array(); $_REQUEST = array(); Yii::app()->session->close(); parent::_after($test); }
/** * @param $url */ protected function debugResponse($url) { parent::debugResponse($url); if ($profile = $this->getProfile()) { if ($profile->hasCollector('security')) { if ($profile->getCollector('security')->isAuthenticated()) { $this->debugSection('User', $profile->getCollector('security')->getUser() . ' [' . implode(',', $profile->getCollector('security')->getRoles()) . ']'); } else { $this->debugSection('User', 'Anonymous'); } } if ($profile->hasCollector('swiftmailer')) { $messages = $profile->getCollector('swiftmailer')->getMessageCount(); if ($messages) { $this->debugSection('Emails', $messages . ' sent'); } } if ($profile->hasCollector('timer')) { $this->debugSection('Time', $profile->getCollector('timer')->getTime()); } } }
/** * Constructor. * * @param ModuleContainer $container * @param array|null $config */ public function __construct(ModuleContainer $container, $config = null) { $this->config = array_merge(['cleanup' => true, 'environment_file' => '.env', 'bootstrap' => 'bootstrap' . DIRECTORY_SEPARATOR . 'app.php', 'root' => '', 'packages' => 'workbench', 'disable_middleware' => false, 'disable_events' => false], (array) $config); $projectDir = explode($this->config['packages'], \Codeception\Configuration::projectDir())[0]; $projectDir .= $this->config['root']; $this->config['project_dir'] = $projectDir; $this->config['bootstrap_file'] = $projectDir . $this->config['bootstrap']; parent::__construct($container); }
/** * After step hook. * * @param \Codeception\Step $step */ public function _afterStep(\Codeception\Step $step) { parent::_afterStep($step); }
/** * Constructor. * * @param ModuleContainer $container * @param $config */ public function __construct(ModuleContainer $container, $config = null) { $this->config = array_merge(array('cleanup' => true, 'bootstrap' => 'bootstrap' . DIRECTORY_SEPARATOR . 'app.php', 'root' => '', 'packages' => 'workbench'), (array) $config); parent::__construct($container); }
/** * @param $url */ protected function debugResponse($url) { parent::debugResponse($url); $this->debugSection('Session', json_encode($_COOKIE)); if ($this->db) { $profiler = $this->db->getProfiler(); $queries = $profiler->getTotalNumQueries() - $this->queries; $time = $profiler->getTotalElapsedSecs() - $this->time; $this->debugSection('Db', $queries . ' queries'); $this->debugSection('Time', round($time, 2) . ' secs taken'); $this->time = $profiler->getTotalElapsedSecs(); $this->queries = $profiler->getTotalNumQueries(); } }
/** * Converting $page to valid Yii 2 URL * * Allows input like: * * ```php * $I->amOnPage(['site/view','page'=>'about']); * $I->amOnPage('index-test.php?site/index'); * $I->amOnPage('http://localhost/index-test.php?site/index'); * ``` * * @param $page string|array parameter for \yii\web\UrlManager::createUrl() */ public function amOnPage($page) { if (is_array($page)) { $page = Yii::$app->getUrlManager()->createUrl($page); } parent::amOnPage($page); }
/** * After step hook. * * @param \Codeception\Step $step */ public function _afterStep(Step $step) { Facade::clearResolvedInstances(); parent::_afterStep($step); }