return [ | return [ | ||||
'id' => 'app-backend', | 'id' => 'app-backend', | ||||
'name' => 'distrib', | |||||
'basePath' => dirname(__DIR__), | 'basePath' => dirname(__DIR__), | ||||
'name' => 'distrib', | |||||
'controllerNamespace' => 'backend\controllers', | 'controllerNamespace' => 'backend\controllers', | ||||
'defaultRoute' => 'site/index', | 'defaultRoute' => 'site/index', | ||||
'bootstrap' => ['log'], | 'bootstrap' => ['log'], |
use common\components\BusinessLogic; | use common\components\BusinessLogic; | ||||
$serverName = $_SERVER['SERVER_NAME']; | |||||
$serverName = isset($_SERVER['SERVER_NAME']) ?? ''; | |||||
return [ | return [ | ||||
'aliases' => [ | |||||
'@bower' => '@vendor/bower-asset', | |||||
'aliases' => [ | |||||
'@bower' => '@vendor/bower-asset', | |||||
], | |||||
'vendorPath' => dirname(__DIR__, 2) . '/vendor', | |||||
'on beforeRequest' => function () { | |||||
if (method_exists(Yii::$app->request, 'getAbsoluteUrl')) { | |||||
$url = Yii::$app->request->getAbsoluteUrl(); | |||||
if ($_SERVER['SERVER_NAME'] != 'localhost' && !empty($url) && substr($url, -1) == '/' && substr($url, -5) != '.net/') { | |||||
$url = substr($url, 0, strlen($url) - 1); | |||||
Yii::$app->getResponse()->redirect($url, 301); | |||||
Yii::$app->end(); | |||||
} | |||||
} | |||||
}, | |||||
'components' => [ | |||||
'assetManager' => [ | |||||
'linkAssets' => YII_ENV == "dev" ? 'true' : false, | |||||
], | ], | ||||
'vendorPath' => dirname(dirname(__DIR__)) . '/vendor', | |||||
'on beforeRequest' => function () { | |||||
if (method_exists(Yii::$app->request, 'getAbsoluteUrl')) { | |||||
$url = Yii::$app->request->getAbsoluteUrl(); | |||||
if ($_SERVER['SERVER_NAME'] != 'localhost' && !empty($url) && substr($url, -1) == '/' && substr($url, -5) != '.net/') { | |||||
$url = substr($url, 0, strlen($url) - 1); | |||||
Yii::$app->getResponse()->redirect($url, 301); | |||||
Yii::$app->end(); | |||||
} | |||||
} | |||||
}, | |||||
'components' => [ | |||||
'assetManager' => [ | |||||
'linkAssets' => YII_ENV == "dev" ? 'true' : false, | |||||
], | |||||
'user' => [ | |||||
'class' => 'yii\web\User', | |||||
'identityClass' => 'common\logic\User\User\Model\User', | |||||
'enableAutoLogin' => true, | |||||
'identityCookie' => [ | |||||
'name' => 'distrib', | |||||
'domain' => (($serverName != 'localhost') ? '.' : '') . Yii::getAlias('@domainName'), | |||||
'path' => '/', | |||||
] | |||||
], | |||||
'session' => [ | |||||
'class' => 'yii\web\Session', | |||||
'name' => 'PHPDISTRIBSESSID', | |||||
'cookieParams' => [ | |||||
'domain' => (($serverName != 'localhost') ? '.' : '') . Yii::getAlias('@domainName'), | |||||
'httpOnly' => true, | |||||
], | |||||
], | |||||
'cache' => [ | |||||
'class' => 'yii\caching\FileCache', | |||||
], | |||||
'image' => [ | |||||
'class' => 'yii\image\ImageDriver', | |||||
'driver' => 'GD', //GD or Imagick | |||||
], | |||||
'urlManagerProducer' => [ | |||||
'class' => 'producer\components\UrlManagerProducer', | |||||
'subDomain' => Yii::getAlias('@producerSubdomain'), | |||||
'domainName' => Yii::getAlias('@domainName'), | |||||
'baseUrl' => Yii::getAlias('@baseUrl') . Yii::getAlias('@baseUrlProducer'), | |||||
'enablePrettyUrl' => true, | |||||
'showScriptName' => false, | |||||
'enableStrictParsing' => false, | |||||
'rules' => [ | |||||
'<slug_producer:\w+>' => 'site/index', | |||||
'<slug_producer:\w+>/<controller>/<action>' => '<controller>/<action>', | |||||
], | |||||
], | |||||
'urlManagerFrontend' => [ | |||||
'class' => 'common\components\UrlManagerCommon', | |||||
'subDomain' => Yii::getAlias('@frontendSubdomain'), | |||||
'domainName' => Yii::getAlias('@domainName'), | |||||
'baseUrl' => Yii::getAlias('@baseUrl') . Yii::getAlias('@baseUrlFrontend'), | |||||
'enablePrettyUrl' => true, | |||||
'showScriptName' => false, | |||||
'enableStrictParsing' => false, | |||||
'rules' => [ | |||||
], | |||||
], | |||||
'urlManagerBackend' => [ | |||||
'class' => 'common\components\UrlManagerCommon', | |||||
'subDomain' => Yii::getAlias('@backendSubdomain'), | |||||
'domainName' => Yii::getAlias('@domainName'), | |||||
'baseUrl' => Yii::getAlias('@baseUrl') . Yii::getAlias('@baseUrlBackend'), | |||||
'enablePrettyUrl' => true, | |||||
'showScriptName' => false, | |||||
'enableStrictParsing' => false, | |||||
'rules' => [ | |||||
], | |||||
], | |||||
'logic' => function() { | |||||
return new BusinessLogic(); | |||||
} | |||||
'user' => [ | |||||
'class' => 'yii\web\User', | |||||
'identityClass' => 'common\logic\User\User\Model\User', | |||||
'enableAutoLogin' => true, | |||||
'identityCookie' => [ | |||||
'name' => 'distrib', | |||||
'domain' => (($serverName != 'localhost') ? '.' : '') . Yii::getAlias('@domainName'), | |||||
'path' => '/', | |||||
] | |||||
], | ], | ||||
'language' => 'fr-FR', | |||||
'session' => [ | |||||
'class' => 'yii\web\Session', | |||||
'name' => 'PHPDISTRIBSESSID', | |||||
'cookieParams' => [ | |||||
'domain' => (($serverName != 'localhost') ? '.' : '') . Yii::getAlias('@domainName'), | |||||
'httpOnly' => true, | |||||
], | |||||
], | |||||
'cache' => [ | |||||
'class' => 'yii\caching\FileCache', | |||||
], | |||||
'image' => [ | |||||
'class' => 'yii\image\ImageDriver', | |||||
'driver' => 'GD', //GD or Imagick | |||||
], | |||||
'urlManagerProducer' => [ | |||||
'class' => 'producer\components\UrlManagerProducer', | |||||
'subDomain' => Yii::getAlias('@producerSubdomain'), | |||||
'domainName' => Yii::getAlias('@domainName'), | |||||
'baseUrl' => Yii::getAlias('@baseUrl') . Yii::getAlias('@baseUrlProducer'), | |||||
'enablePrettyUrl' => true, | |||||
'showScriptName' => false, | |||||
'enableStrictParsing' => false, | |||||
'rules' => [ | |||||
'<slug_producer:\w+>' => 'site/index', | |||||
'<slug_producer:\w+>/<controller>/<action>' => '<controller>/<action>', | |||||
], | |||||
], | |||||
'urlManagerFrontend' => [ | |||||
'class' => 'common\components\UrlManagerCommon', | |||||
'subDomain' => Yii::getAlias('@frontendSubdomain'), | |||||
'domainName' => Yii::getAlias('@domainName'), | |||||
'baseUrl' => Yii::getAlias('@baseUrl') . Yii::getAlias('@baseUrlFrontend'), | |||||
'enablePrettyUrl' => true, | |||||
'showScriptName' => false, | |||||
'enableStrictParsing' => false, | |||||
'rules' => [ | |||||
], | |||||
], | |||||
'urlManagerBackend' => [ | |||||
'class' => 'common\components\UrlManagerCommon', | |||||
'subDomain' => Yii::getAlias('@backendSubdomain'), | |||||
'domainName' => Yii::getAlias('@domainName'), | |||||
'baseUrl' => Yii::getAlias('@baseUrl') . Yii::getAlias('@baseUrlBackend'), | |||||
'enablePrettyUrl' => true, | |||||
'showScriptName' => false, | |||||
'enableStrictParsing' => false, | |||||
'rules' => [ | |||||
], | |||||
], | |||||
'logic' => function () { | |||||
return new BusinessLogic(); | |||||
} | |||||
], | |||||
'language' => 'fr-FR', | |||||
]; | ]; |
<?php | |||||
return [ | |||||
'components' => [ | |||||
'db' => [ | |||||
'class' => 'yii\db\Connection', | |||||
'dsn' => 'mysql:host=localhost;dbname=opendistrib_test', | |||||
'username' => 'root', | |||||
'password' => 'k&mysql*$=', | |||||
'charset' => 'utf8', | |||||
], | |||||
'mailer' => [ | |||||
'class' => 'yii\swiftmailer\Mailer', | |||||
'viewPath' => '@common/mail', | |||||
// send all mails to a file by default. You have to set | |||||
// 'useFileTransport' to false and configure a transport | |||||
// for the mailer to send real emails. | |||||
'useFileTransport' => true, | |||||
'transport' => [ | |||||
'class' => 'Swift_SmtpTransport', | |||||
'host' => 'smtp-laclic.alwaysdata.net', | |||||
'username' => 'contact@opendistrib.net', | |||||
'password' => 'k&opendistrib*$=', | |||||
'port' => '587', | |||||
//'encryption' => 'tls', | |||||
], | |||||
], | |||||
], | |||||
]; |
define('YII_ENV', 'test'); | define('YII_ENV', 'test'); | ||||
defined('YII_DEBUG') or define('YII_DEBUG', true); | defined('YII_DEBUG') or define('YII_DEBUG', true); | ||||
require_once __DIR__ . '/../vendor/yiisoft/yii2/Yii.php'; | require_once __DIR__ . '/../vendor/yiisoft/yii2/Yii.php'; | ||||
require __DIR__ .'/../vendor/autoload.php'; | |||||
require __DIR__ .'/../vendor/autoload.php'; | |||||
// @see common/config/bootstrap.php | |||||
$dirname = dirname(__DIR__); | |||||
Yii::setAlias('common', $dirname.'/common'); | |||||
Yii::setAlias('frontend', $dirname . '/frontend'); | |||||
Yii::setAlias('backend', $dirname . '/backend'); | |||||
Yii::setAlias('console', $dirname . '/console'); | |||||
Yii::setAlias('producer', $dirname . '/producer'); | |||||
$serverName = isset($_SERVER['SERVER_NAME']) ?? '' ; | |||||
$domainName = '' ; | |||||
if($serverName == 'localhost') { | |||||
$domainName = 'localhost' ; | |||||
} | |||||
else { | |||||
$domainName = (YII_ENV === 'dev') ? 'opendistrib-beta.net' : 'opendistrib.net' ; | |||||
} | |||||
Yii::setAlias('@domainName', $domainName); | |||||
Yii::setAlias('@baseUrl', ($serverName == 'localhost') ? '/Opendistrib/' : '/'); | |||||
Yii::setAlias('@baseUrlFrontend', (($serverName == 'localhost') ? '/frontend/web' : '')); | |||||
Yii::setAlias('@baseUrlBackend', (($serverName == 'localhost') ? '/backend/web' : '')); | |||||
Yii::setAlias('@baseUrlProducer', (($serverName == 'localhost') ? '/producer/web' : '')); | |||||
Yii::setAlias('@frontendSubdomain', (($serverName == 'localhost') ? '' : 'www')); | |||||
Yii::setAlias('@backendSubdomain', (($serverName == 'localhost') ? '' : 'admin')); | |||||
Yii::setAlias('@producerSubdomain', (($serverName == 'localhost') ? '' : 'producteurs')); | |||||
/* | |||||
* Autoload | |||||
*/ | |||||
Yii::$classMap['Import'] = Yii::getAlias('@common/exts/Import.php'); | |||||
Import::using('common\components\*'); |
<?php //[STAMP] 95a302f02389156d9cbbb435ba70b332 | |||||
<?php //[STAMP] 07c05d2f1dfce28c06b749b2ec62500c | |||||
namespace tests\codeception\backend\_generated; | namespace tests\codeception\backend\_generated; | ||||
// This class was automatically generated by build task | // This class was automatically generated by build task | ||||
* // CSS button | * // CSS button | ||||
* $I->click('#form input[type=submit]'); | * $I->click('#form input[type=submit]'); | ||||
* // XPath | * // XPath | ||||
* $I->click('//form/*[@type=submit]'); | |||||
* $I->click('//form/*[@type="submit"]'); | |||||
* // link in context | * // link in context | ||||
* $I->click('Logout', '#nav'); | * $I->click('Logout', '#nav'); | ||||
* // using strict locator | * // using strict locator | ||||
* For checking the raw source code, use `seeInSource()`. | * For checking the raw source code, use `seeInSource()`. | ||||
* | * | ||||
* @param string $text | * @param string $text | ||||
* @param string $selector optional | |||||
* @param array|string $selector optional | |||||
* Conditional Assertion: Test won't be stopped on fail | * Conditional Assertion: Test won't be stopped on fail | ||||
* @see \Codeception\Lib\InnerBrowser::see() | * @see \Codeception\Lib\InnerBrowser::see() | ||||
*/ | */ | ||||
* For checking the raw source code, use `seeInSource()`. | * For checking the raw source code, use `seeInSource()`. | ||||
* | * | ||||
* @param string $text | * @param string $text | ||||
* @param string $selector optional | |||||
* @param array|string $selector optional | |||||
* @see \Codeception\Lib\InnerBrowser::see() | * @see \Codeception\Lib\InnerBrowser::see() | ||||
*/ | */ | ||||
public function see($text, $selector = null) { | public function see($text, $selector = null) { | ||||
* For checking the raw source code, use `seeInSource()`. | * For checking the raw source code, use `seeInSource()`. | ||||
* | * | ||||
* @param string $text | * @param string $text | ||||
* @param string $selector optional | |||||
* @param array|string $selector optional | |||||
* Conditional Assertion: Test won't be stopped on fail | * Conditional Assertion: Test won't be stopped on fail | ||||
* @see \Codeception\Lib\InnerBrowser::dontSee() | * @see \Codeception\Lib\InnerBrowser::dontSee() | ||||
*/ | */ | ||||
* For checking the raw source code, use `seeInSource()`. | * For checking the raw source code, use `seeInSource()`. | ||||
* | * | ||||
* @param string $text | * @param string $text | ||||
* @param string $selector optional | |||||
* @param array|string $selector optional | |||||
* @see \Codeception\Lib\InnerBrowser::dontSee() | * @see \Codeception\Lib\InnerBrowser::dontSee() | ||||
*/ | */ | ||||
public function dontSee($text, $selector = null) { | public function dontSee($text, $selector = null) { | ||||
* ``` php | * ``` php | ||||
* <?php | * <?php | ||||
* // to match root url | * // to match root url | ||||
* $I->seeCurrentUrlMatches('~$/users/(\d+)~'); | |||||
* $I->seeCurrentUrlMatches('~^/users/(\d+)~'); | |||||
* ?> | * ?> | ||||
* ``` | * ``` | ||||
* | * | ||||
* ``` php | * ``` php | ||||
* <?php | * <?php | ||||
* // to match root url | * // to match root url | ||||
* $I->seeCurrentUrlMatches('~$/users/(\d+)~'); | |||||
* $I->seeCurrentUrlMatches('~^/users/(\d+)~'); | |||||
* ?> | * ?> | ||||
* ``` | * ``` | ||||
* | * | ||||
* ``` php | * ``` php | ||||
* <?php | * <?php | ||||
* // to match root url | * // to match root url | ||||
* $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~'); | |||||
* $I->dontSeeCurrentUrlMatches('~^/users/(\d+)~'); | |||||
* ?> | * ?> | ||||
* ``` | * ``` | ||||
* | * | ||||
* ``` php | * ``` php | ||||
* <?php | * <?php | ||||
* // to match root url | * // to match root url | ||||
* $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~'); | |||||
* $I->dontSeeCurrentUrlMatches('~^/users/(\d+)~'); | |||||
* ?> | * ?> | ||||
* ``` | * ``` | ||||
* | * | ||||
* | * | ||||
* ``` php | * ``` php | ||||
* <?php | * <?php | ||||
* $user_id = $I->grabFromCurrentUrl('~$/user/(\d+)/~'); | |||||
* $user_id = $I->grabFromCurrentUrl('~^/user/(\d+)/~'); | |||||
* $uri = $I->grabFromCurrentUrl(); | * $uri = $I->grabFromCurrentUrl(); | ||||
* ?> | * ?> | ||||
* ``` | * ``` | ||||
} | } | ||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that response code is between a certain range. Between actually means [from <= CODE <= to] | |||||
* | |||||
* @param $from | |||||
* @param $to | |||||
* Conditional Assertion: Test won't be stopped on fail | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsBetween() | |||||
*/ | |||||
public function canSeeResponseCodeIsBetween($from, $to) { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsBetween', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that response code is between a certain range. Between actually means [from <= CODE <= to] | |||||
* | |||||
* @param $from | |||||
* @param $to | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsBetween() | |||||
*/ | |||||
public function seeResponseCodeIsBetween($from, $to) { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsBetween', func_get_args())); | |||||
} | |||||
/** | /** | ||||
* [!] Method is generated. Documentation taken from corresponding module. | * [!] Method is generated. Documentation taken from corresponding module. | ||||
* | * | ||||
} | } | ||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code 2xx | |||||
* Conditional Assertion: Test won't be stopped on fail | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsSuccessful() | |||||
*/ | |||||
public function canSeeResponseCodeIsSuccessful() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsSuccessful', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code 2xx | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsSuccessful() | |||||
*/ | |||||
public function seeResponseCodeIsSuccessful() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsSuccessful', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code 3xx | |||||
* Conditional Assertion: Test won't be stopped on fail | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsRedirection() | |||||
*/ | |||||
public function canSeeResponseCodeIsRedirection() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsRedirection', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code 3xx | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsRedirection() | |||||
*/ | |||||
public function seeResponseCodeIsRedirection() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsRedirection', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code is 4xx | |||||
* Conditional Assertion: Test won't be stopped on fail | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsClientError() | |||||
*/ | |||||
public function canSeeResponseCodeIsClientError() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsClientError', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code is 4xx | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsClientError() | |||||
*/ | |||||
public function seeResponseCodeIsClientError() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsClientError', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code is 5xx | |||||
* Conditional Assertion: Test won't be stopped on fail | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsServerError() | |||||
*/ | |||||
public function canSeeResponseCodeIsServerError() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsServerError', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code is 5xx | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsServerError() | |||||
*/ | |||||
public function seeResponseCodeIsServerError() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsServerError', func_get_args())); | |||||
} | |||||
/** | /** | ||||
* [!] Method is generated. Documentation taken from corresponding module. | * [!] Method is generated. Documentation taken from corresponding module. | ||||
* | * | ||||
public function fixtures() { | public function fixtures() { | ||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('fixtures', func_get_args())); | return $this->getScenario()->runStep(new \Codeception\Step\Action('fixtures', func_get_args())); | ||||
} | } | ||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Initialize the fixtures. | |||||
* @since 2.0.12 | |||||
* @see \tests\codeception\common\_support\FixtureHelper::initFixtures() | |||||
*/ | |||||
public function initFixtures() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('initFixtures', func_get_args())); | |||||
} | |||||
} | } |
<?php //[STAMP] bc506f891c6c86019a4495b1d981dae8 | |||||
<?php //[STAMP] f27cd14eb2621d7d7c79eb236a027ea5 | |||||
namespace tests\codeception\backend\_generated; | namespace tests\codeception\backend\_generated; | ||||
// This class was automatically generated by build task | // This class was automatically generated by build task | ||||
* @param $component | * @param $component | ||||
* @return mixed | * @return mixed | ||||
* @throws ModuleException | * @throws ModuleException | ||||
* @deprecated in your tests you can use \Yii::$app directly. | |||||
* @see \Codeception\Module\Yii2::grabComponent() | * @see \Codeception\Module\Yii2::grabComponent() | ||||
*/ | */ | ||||
public function grabComponent($component) { | public function grabComponent($component) { | ||||
* [!] Method is generated. Documentation taken from corresponding module. | * [!] Method is generated. Documentation taken from corresponding module. | ||||
* | * | ||||
* Returns array of all sent email messages. | * Returns array of all sent email messages. | ||||
* Each message implements `yii\mail\Message` interface. | |||||
* Each message implements `yii\mail\MessageInterface` interface. | |||||
* Useful to perform additional checks using `Asserts` module: | * Useful to perform additional checks using `Asserts` module: | ||||
* | * | ||||
* ```php | * ```php | ||||
} | } | ||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Sets a cookie and, if validation is enabled, signs it. | |||||
* @param string $name The name of the cookie | |||||
* @param string $value The value of the cookie | |||||
* @param array $params Additional cookie params like `domain`, `path`, `expires` and `secure`. | |||||
* @see \Codeception\Module\Yii2::setCookie() | |||||
*/ | |||||
public function setCookie($name, $val, $params = null) { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('setCookie', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* This function creates the CSRF Cookie. | |||||
* @param string $val The value of the CSRF token | |||||
* @return string[] Returns an array containing the name of the CSRF param and the masked CSRF token. | |||||
* @see \Codeception\Module\Yii2::createAndSetCsrfCookie() | |||||
*/ | |||||
public function createAndSetCsrfCookie($val) { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('createAndSetCsrfCookie', func_get_args())); | |||||
} | |||||
/** | /** | ||||
* [!] Method is generated. Documentation taken from corresponding module. | * [!] Method is generated. Documentation taken from corresponding module. | ||||
* | * | ||||
* // CSS button | * // CSS button | ||||
* $I->click('#form input[type=submit]'); | * $I->click('#form input[type=submit]'); | ||||
* // XPath | * // XPath | ||||
* $I->click('//form/*[@type=submit]'); | |||||
* $I->click('//form/*[@type="submit"]'); | |||||
* // link in context | * // link in context | ||||
* $I->click('Logout', '#nav'); | * $I->click('Logout', '#nav'); | ||||
* // using strict locator | * // using strict locator | ||||
* For checking the raw source code, use `seeInSource()`. | * For checking the raw source code, use `seeInSource()`. | ||||
* | * | ||||
* @param string $text | * @param string $text | ||||
* @param string $selector optional | |||||
* @param array|string $selector optional | |||||
* Conditional Assertion: Test won't be stopped on fail | * Conditional Assertion: Test won't be stopped on fail | ||||
* @see \Codeception\Lib\InnerBrowser::see() | * @see \Codeception\Lib\InnerBrowser::see() | ||||
*/ | */ | ||||
* For checking the raw source code, use `seeInSource()`. | * For checking the raw source code, use `seeInSource()`. | ||||
* | * | ||||
* @param string $text | * @param string $text | ||||
* @param string $selector optional | |||||
* @param array|string $selector optional | |||||
* @see \Codeception\Lib\InnerBrowser::see() | * @see \Codeception\Lib\InnerBrowser::see() | ||||
*/ | */ | ||||
public function see($text, $selector = null) { | public function see($text, $selector = null) { | ||||
* For checking the raw source code, use `seeInSource()`. | * For checking the raw source code, use `seeInSource()`. | ||||
* | * | ||||
* @param string $text | * @param string $text | ||||
* @param string $selector optional | |||||
* @param array|string $selector optional | |||||
* Conditional Assertion: Test won't be stopped on fail | * Conditional Assertion: Test won't be stopped on fail | ||||
* @see \Codeception\Lib\InnerBrowser::dontSee() | * @see \Codeception\Lib\InnerBrowser::dontSee() | ||||
*/ | */ | ||||
* For checking the raw source code, use `seeInSource()`. | * For checking the raw source code, use `seeInSource()`. | ||||
* | * | ||||
* @param string $text | * @param string $text | ||||
* @param string $selector optional | |||||
* @param array|string $selector optional | |||||
* @see \Codeception\Lib\InnerBrowser::dontSee() | * @see \Codeception\Lib\InnerBrowser::dontSee() | ||||
*/ | */ | ||||
public function dontSee($text, $selector = null) { | public function dontSee($text, $selector = null) { | ||||
* ``` php | * ``` php | ||||
* <?php | * <?php | ||||
* // to match root url | * // to match root url | ||||
* $I->seeCurrentUrlMatches('~$/users/(\d+)~'); | |||||
* $I->seeCurrentUrlMatches('~^/users/(\d+)~'); | |||||
* ?> | * ?> | ||||
* ``` | * ``` | ||||
* | * | ||||
* ``` php | * ``` php | ||||
* <?php | * <?php | ||||
* // to match root url | * // to match root url | ||||
* $I->seeCurrentUrlMatches('~$/users/(\d+)~'); | |||||
* $I->seeCurrentUrlMatches('~^/users/(\d+)~'); | |||||
* ?> | * ?> | ||||
* ``` | * ``` | ||||
* | * | ||||
* ``` php | * ``` php | ||||
* <?php | * <?php | ||||
* // to match root url | * // to match root url | ||||
* $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~'); | |||||
* $I->dontSeeCurrentUrlMatches('~^/users/(\d+)~'); | |||||
* ?> | * ?> | ||||
* ``` | * ``` | ||||
* | * | ||||
* ``` php | * ``` php | ||||
* <?php | * <?php | ||||
* // to match root url | * // to match root url | ||||
* $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~'); | |||||
* $I->dontSeeCurrentUrlMatches('~^/users/(\d+)~'); | |||||
* ?> | * ?> | ||||
* ``` | * ``` | ||||
* | * | ||||
* | * | ||||
* ``` php | * ``` php | ||||
* <?php | * <?php | ||||
* $user_id = $I->grabFromCurrentUrl('~$/user/(\d+)/~'); | |||||
* $user_id = $I->grabFromCurrentUrl('~^/user/(\d+)/~'); | |||||
* $uri = $I->grabFromCurrentUrl(); | * $uri = $I->grabFromCurrentUrl(); | ||||
* ?> | * ?> | ||||
* ``` | * ``` | ||||
} | } | ||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Sets a cookie with the given name and value. | |||||
* You can set additional cookie params like `domain`, `path`, `expires`, `secure` in array passed as last argument. | |||||
* | |||||
* ``` php | |||||
* <?php | |||||
* $I->setCookie('PHPSESSID', 'el4ukv0kqbvoirg7nkp4dncpk3'); | |||||
* ?> | |||||
* ``` | |||||
* | |||||
* @param $name | |||||
* @param $val | |||||
* @param array $params | |||||
* | |||||
* @return mixed | |||||
* @see \Codeception\Lib\InnerBrowser::setCookie() | |||||
*/ | |||||
public function setCookie($name, $val, $params = null) { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('setCookie', func_get_args())); | |||||
} | |||||
/** | /** | ||||
* [!] Method is generated. Documentation taken from corresponding module. | * [!] Method is generated. Documentation taken from corresponding module. | ||||
* | * | ||||
} | } | ||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that response code is between a certain range. Between actually means [from <= CODE <= to] | |||||
* | |||||
* @param $from | |||||
* @param $to | |||||
* Conditional Assertion: Test won't be stopped on fail | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsBetween() | |||||
*/ | |||||
public function canSeeResponseCodeIsBetween($from, $to) { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsBetween', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that response code is between a certain range. Between actually means [from <= CODE <= to] | |||||
* | |||||
* @param $from | |||||
* @param $to | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsBetween() | |||||
*/ | |||||
public function seeResponseCodeIsBetween($from, $to) { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsBetween', func_get_args())); | |||||
} | |||||
/** | /** | ||||
* [!] Method is generated. Documentation taken from corresponding module. | * [!] Method is generated. Documentation taken from corresponding module. | ||||
* | * | ||||
} | } | ||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code 2xx | |||||
* Conditional Assertion: Test won't be stopped on fail | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsSuccessful() | |||||
*/ | |||||
public function canSeeResponseCodeIsSuccessful() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsSuccessful', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code 2xx | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsSuccessful() | |||||
*/ | |||||
public function seeResponseCodeIsSuccessful() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsSuccessful', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code 3xx | |||||
* Conditional Assertion: Test won't be stopped on fail | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsRedirection() | |||||
*/ | |||||
public function canSeeResponseCodeIsRedirection() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsRedirection', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code 3xx | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsRedirection() | |||||
*/ | |||||
public function seeResponseCodeIsRedirection() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsRedirection', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code is 4xx | |||||
* Conditional Assertion: Test won't be stopped on fail | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsClientError() | |||||
*/ | |||||
public function canSeeResponseCodeIsClientError() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsClientError', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code is 4xx | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsClientError() | |||||
*/ | |||||
public function seeResponseCodeIsClientError() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsClientError', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code is 5xx | |||||
* Conditional Assertion: Test won't be stopped on fail | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsServerError() | |||||
*/ | |||||
public function canSeeResponseCodeIsServerError() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsServerError', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code is 5xx | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsServerError() | |||||
*/ | |||||
public function seeResponseCodeIsServerError() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsServerError', func_get_args())); | |||||
} | |||||
/** | /** | ||||
* [!] Method is generated. Documentation taken from corresponding module. | * [!] Method is generated. Documentation taken from corresponding module. | ||||
* | * | ||||
public function fixtures() { | public function fixtures() { | ||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('fixtures', func_get_args())); | return $this->getScenario()->runStep(new \Codeception\Step\Action('fixtures', func_get_args())); | ||||
} | } | ||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Initialize the fixtures. | |||||
* @since 2.0.12 | |||||
* @see \tests\codeception\common\_support\FixtureHelper::initFixtures() | |||||
*/ | |||||
public function initFixtures() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('initFixtures', func_get_args())); | |||||
} | |||||
} | } |
<?php //[STAMP] ed4d8cdd8d9d71e1210063b99c8b8445 | |||||
<?php //[STAMP] e543475a72b3c2b2bbb166e62bf94035 | |||||
namespace tests\codeception\backend\_generated; | namespace tests\codeception\backend\_generated; | ||||
// This class was automatically generated by build task | // This class was automatically generated by build task |
paths: | |||||
tests: tests | |||||
output: tests/_output | |||||
data: tests/_data | |||||
support: tests/_support | |||||
envs: tests/_envs | |||||
actor_suffix: Tester | |||||
extensions: | |||||
enabled: | |||||
- Codeception\Extension\RunFailed |
*/ | */ | ||||
public function login($username, $password) | public function login($username, $password) | ||||
{ | { | ||||
$this->actor->fillField('input[name="LoginForm[username]"]', $username); | |||||
$this->actor->fillField('input[name="LoginForm[email]"]', $username); | |||||
$this->actor->fillField('input[name="LoginForm[password]"]', $password); | $this->actor->fillField('input[name="LoginForm[password]"]', $password); | ||||
$this->actor->click('login-button'); | $this->actor->click('login-button'); | ||||
} | } |
<?php | |||||
namespace tests\codeception\common; | |||||
/** | |||||
* Inherited Methods | |||||
* @method void wantToTest($text) | |||||
* @method void wantTo($text) | |||||
* @method void execute($callable) | |||||
* @method void expectTo($prediction) | |||||
* @method void expect($prediction) | |||||
* @method void amGoingTo($argumentation) | |||||
* @method void am($role) | |||||
* @method void lookForwardTo($achieveValue) | |||||
* @method void comment($description) | |||||
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL) | |||||
* | |||||
* @SuppressWarnings(PHPMD) | |||||
*/ | |||||
class UnitTester extends \Codeception\Actor | |||||
{ | |||||
use _generated\UnitTesterActions; | |||||
/** | |||||
* Define custom actions here | |||||
*/ | |||||
} |
<?php //[STAMP] e543475a72b3c2b2bbb166e62bf94035 | |||||
namespace tests\codeception\common\_generated; | |||||
// This class was automatically generated by build task | |||||
// You should not change it manually as it will be overwritten on next build | |||||
// @codingStandardsIgnoreFile | |||||
trait UnitTesterActions | |||||
{ | |||||
/** | |||||
* @return \Codeception\Scenario | |||||
*/ | |||||
abstract protected function getScenario(); | |||||
} |
*/ | */ | ||||
class UserFixture extends ActiveFixture | class UserFixture extends ActiveFixture | ||||
{ | { | ||||
public $modelClass = 'common\models\UserModel'; | |||||
public $modelClass = 'common\logic\User\User\Model\User'; | |||||
} | } |
'components' => [ | 'components' => [ | ||||
'user' => [ | 'user' => [ | ||||
'class' => 'yii\web\User', | 'class' => 'yii\web\User', | ||||
'identityClass' => 'common\models\UserModel', | |||||
'identityClass' => 'common\logic\User\User\Model\User', | |||||
], | ], | ||||
], | ], | ||||
]); | ]); |
*/ | */ | ||||
return yii\helpers\ArrayHelper::merge( | return yii\helpers\ArrayHelper::merge( | ||||
require(YII_APP_BASE_PATH . '/common/config/main.php'), | require(YII_APP_BASE_PATH . '/common/config/main.php'), | ||||
require(YII_APP_BASE_PATH . '/common/config/main-local.php'), | |||||
require(YII_APP_BASE_PATH . '/common/config/test-local.php'), | |||||
require(YII_APP_BASE_PATH . '/backend/config/main.php'), | require(YII_APP_BASE_PATH . '/backend/config/main.php'), | ||||
require(YII_APP_BASE_PATH . '/backend/config/main-local.php'), | require(YII_APP_BASE_PATH . '/backend/config/main-local.php'), | ||||
require(dirname(__DIR__) . '/config.php'), | require(dirname(__DIR__) . '/config.php'), |
*/ | */ | ||||
return yii\helpers\ArrayHelper::merge( | return yii\helpers\ArrayHelper::merge( | ||||
require(YII_APP_BASE_PATH . '/common/config/main.php'), | require(YII_APP_BASE_PATH . '/common/config/main.php'), | ||||
require(YII_APP_BASE_PATH . '/common/config/main-local.php'), | |||||
require(YII_APP_BASE_PATH . '/common/config/test-local.php'), | |||||
require(YII_APP_BASE_PATH . '/backend/config/main.php'), | require(YII_APP_BASE_PATH . '/backend/config/main.php'), | ||||
require(YII_APP_BASE_PATH . '/backend/config/main-local.php'), | require(YII_APP_BASE_PATH . '/backend/config/main-local.php'), | ||||
require(dirname(__DIR__) . '/config.php'), | require(dirname(__DIR__) . '/config.php'), |
*/ | */ | ||||
return yii\helpers\ArrayHelper::merge( | return yii\helpers\ArrayHelper::merge( | ||||
require(YII_APP_BASE_PATH . '/common/config/main.php'), | require(YII_APP_BASE_PATH . '/common/config/main.php'), | ||||
require(YII_APP_BASE_PATH . '/common/config/main-local.php'), | |||||
require(YII_APP_BASE_PATH . '/common/config/test-local.php'), | |||||
require(YII_APP_BASE_PATH . '/backend/config/main.php'), | require(YII_APP_BASE_PATH . '/backend/config/main.php'), | ||||
require(YII_APP_BASE_PATH . '/backend/config/main-local.php'), | require(YII_APP_BASE_PATH . '/backend/config/main-local.php'), | ||||
require(dirname(__DIR__) . '/config.php'), | require(dirname(__DIR__) . '/config.php'), |
*/ | */ | ||||
return yii\helpers\ArrayHelper::merge( | return yii\helpers\ArrayHelper::merge( | ||||
require(YII_APP_BASE_PATH . '/common/config/main.php'), | require(YII_APP_BASE_PATH . '/common/config/main.php'), | ||||
require(YII_APP_BASE_PATH . '/common/config/main-local.php'), | |||||
require(YII_APP_BASE_PATH . '/common/config/test-local.php'), | |||||
require(dirname(__DIR__) . '/config.php'), | require(dirname(__DIR__) . '/config.php'), | ||||
require(dirname(__DIR__) . '/unit.php'), | require(dirname(__DIR__) . '/unit.php'), | ||||
[ | [ |
<?php | <?php | ||||
$config = yii\helpers\ArrayHelper::merge( | $config = yii\helpers\ArrayHelper::merge( | ||||
require(__DIR__ . '/../../../frontend/config/main.php'), | |||||
require(__DIR__ . '/../../../frontend/config/main-local.php'), | |||||
require(__DIR__ . '/../../../common/config/main.php'), | |||||
require(__DIR__ . '/../../../common/config/test-local.php'), | |||||
[ | [ | ||||
'id' => 'app-tests', | |||||
//'basePath' => dirname(__DIR__), | |||||
] | |||||
/*[ | |||||
'id' => 'app-tests', | 'id' => 'app-tests', | ||||
'components' => [ | 'components' => [ | ||||
'db' => [ | 'db' => [ | ||||
//'site' => 'app\controllers\SiteController', | //'site' => 'app\controllers\SiteController', | ||||
//'frontend' => 'app\controllers\FrontendController', | //'frontend' => 'app\controllers\FrontendController', | ||||
], | ], | ||||
] | |||||
]*/ | |||||
); | ); | ||||
return $config; | return $config; |
*/ | */ | ||||
return yii\helpers\ArrayHelper::merge( | return yii\helpers\ArrayHelper::merge( | ||||
require(YII_APP_BASE_PATH . '/common/config/main.php'), | require(YII_APP_BASE_PATH . '/common/config/main.php'), | ||||
require(YII_APP_BASE_PATH . '/common/config/main-local.php'), | |||||
require(YII_APP_BASE_PATH . '/common/config/test-local.php'), | |||||
require(YII_APP_BASE_PATH . '/console/config/main.php'), | require(YII_APP_BASE_PATH . '/console/config/main.php'), | ||||
require(YII_APP_BASE_PATH . '/console/config/main-local.php'), | require(YII_APP_BASE_PATH . '/console/config/main-local.php'), | ||||
require(dirname(__DIR__) . '/config.php'), | require(dirname(__DIR__) . '/config.php'), |
*/ | */ | ||||
return yii\helpers\ArrayHelper::merge( | return yii\helpers\ArrayHelper::merge( | ||||
require(YII_APP_BASE_PATH . '/common/config/main.php'), | require(YII_APP_BASE_PATH . '/common/config/main.php'), | ||||
require(YII_APP_BASE_PATH . '/common/config/main-local.php'), | |||||
require(YII_APP_BASE_PATH . '/common/config/test-local.php'), | |||||
require(YII_APP_BASE_PATH . '/frontend/config/main.php'), | require(YII_APP_BASE_PATH . '/frontend/config/main.php'), | ||||
require(YII_APP_BASE_PATH . '/frontend/config/main-local.php'), | require(YII_APP_BASE_PATH . '/frontend/config/main-local.php'), | ||||
require(dirname(__DIR__) . '/config.php'), | require(dirname(__DIR__) . '/config.php'), |
*/ | */ | ||||
return yii\helpers\ArrayHelper::merge( | return yii\helpers\ArrayHelper::merge( | ||||
require(YII_APP_BASE_PATH . '/common/config/main.php'), | require(YII_APP_BASE_PATH . '/common/config/main.php'), | ||||
require(YII_APP_BASE_PATH . '/common/config/main-local.php'), | |||||
require(YII_APP_BASE_PATH . '/common/config/test-local.php'), | |||||
require(YII_APP_BASE_PATH . '/frontend/config/main.php'), | require(YII_APP_BASE_PATH . '/frontend/config/main.php'), | ||||
require(YII_APP_BASE_PATH . '/frontend/config/main-local.php'), | require(YII_APP_BASE_PATH . '/frontend/config/main-local.php'), | ||||
require(dirname(__DIR__) . '/config.php'), | require(dirname(__DIR__) . '/config.php'), |
*/ | */ | ||||
return yii\helpers\ArrayHelper::merge( | return yii\helpers\ArrayHelper::merge( | ||||
require(YII_APP_BASE_PATH . '/common/config/main.php'), | require(YII_APP_BASE_PATH . '/common/config/main.php'), | ||||
require(YII_APP_BASE_PATH . '/common/config/main-local.php'), | |||||
require(YII_APP_BASE_PATH . '/common/config/test-local.php'), | |||||
require(YII_APP_BASE_PATH . '/frontend/config/main.php'), | require(YII_APP_BASE_PATH . '/frontend/config/main.php'), | ||||
require(YII_APP_BASE_PATH . '/frontend/config/main-local.php'), | require(YII_APP_BASE_PATH . '/frontend/config/main-local.php'), | ||||
require(dirname(__DIR__) . '/config.php'), | require(dirname(__DIR__) . '/config.php'), |
<?php | |||||
namespace tests\codeception\console; | |||||
/** | |||||
* Inherited Methods | |||||
* @method void wantToTest($text) | |||||
* @method void wantTo($text) | |||||
* @method void execute($callable) | |||||
* @method void expectTo($prediction) | |||||
* @method void expect($prediction) | |||||
* @method void amGoingTo($argumentation) | |||||
* @method void am($role) | |||||
* @method void lookForwardTo($achieveValue) | |||||
* @method void comment($description) | |||||
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL) | |||||
* | |||||
* @SuppressWarnings(PHPMD) | |||||
*/ | |||||
class UnitTester extends \Codeception\Actor | |||||
{ | |||||
use _generated\UnitTesterActions; | |||||
/** | |||||
* Define custom actions here | |||||
*/ | |||||
} |
<?php //[STAMP] e543475a72b3c2b2bbb166e62bf94035 | |||||
namespace tests\codeception\console\_generated; | |||||
// This class was automatically generated by build task | |||||
// You should not change it manually as it will be overwritten on next build | |||||
// @codingStandardsIgnoreFile | |||||
trait UnitTesterActions | |||||
{ | |||||
/** | |||||
* @return \Codeception\Scenario | |||||
*/ | |||||
abstract protected function getScenario(); | |||||
} |
$_SERVER['SERVER_NAME'] = parse_url(\Codeception\Configuration::config()['config']['test_entry_url'], PHP_URL_HOST); | $_SERVER['SERVER_NAME'] = parse_url(\Codeception\Configuration::config()['config']['test_entry_url'], PHP_URL_HOST); | ||||
$_SERVER['SERVER_PORT'] = parse_url(\Codeception\Configuration::config()['config']['test_entry_url'], PHP_URL_PORT) ?: '80'; | $_SERVER['SERVER_PORT'] = parse_url(\Codeception\Configuration::config()['config']['test_entry_url'], PHP_URL_PORT) ?: '80'; | ||||
Yii::setAlias('@tests', dirname(dirname(__DIR__))); | |||||
Yii::setAlias('@tests', dirname(dirname(__DIR__))); |
<?php //[STAMP] 95a302f02389156d9cbbb435ba70b332 | |||||
<?php //[STAMP] 07c05d2f1dfce28c06b749b2ec62500c | |||||
namespace tests\codeception\frontend\_generated; | namespace tests\codeception\frontend\_generated; | ||||
// This class was automatically generated by build task | // This class was automatically generated by build task | ||||
* // CSS button | * // CSS button | ||||
* $I->click('#form input[type=submit]'); | * $I->click('#form input[type=submit]'); | ||||
* // XPath | * // XPath | ||||
* $I->click('//form/*[@type=submit]'); | |||||
* $I->click('//form/*[@type="submit"]'); | |||||
* // link in context | * // link in context | ||||
* $I->click('Logout', '#nav'); | * $I->click('Logout', '#nav'); | ||||
* // using strict locator | * // using strict locator | ||||
* For checking the raw source code, use `seeInSource()`. | * For checking the raw source code, use `seeInSource()`. | ||||
* | * | ||||
* @param string $text | * @param string $text | ||||
* @param string $selector optional | |||||
* @param array|string $selector optional | |||||
* Conditional Assertion: Test won't be stopped on fail | * Conditional Assertion: Test won't be stopped on fail | ||||
* @see \Codeception\Lib\InnerBrowser::see() | * @see \Codeception\Lib\InnerBrowser::see() | ||||
*/ | */ | ||||
* For checking the raw source code, use `seeInSource()`. | * For checking the raw source code, use `seeInSource()`. | ||||
* | * | ||||
* @param string $text | * @param string $text | ||||
* @param string $selector optional | |||||
* @param array|string $selector optional | |||||
* @see \Codeception\Lib\InnerBrowser::see() | * @see \Codeception\Lib\InnerBrowser::see() | ||||
*/ | */ | ||||
public function see($text, $selector = null) { | public function see($text, $selector = null) { | ||||
* For checking the raw source code, use `seeInSource()`. | * For checking the raw source code, use `seeInSource()`. | ||||
* | * | ||||
* @param string $text | * @param string $text | ||||
* @param string $selector optional | |||||
* @param array|string $selector optional | |||||
* Conditional Assertion: Test won't be stopped on fail | * Conditional Assertion: Test won't be stopped on fail | ||||
* @see \Codeception\Lib\InnerBrowser::dontSee() | * @see \Codeception\Lib\InnerBrowser::dontSee() | ||||
*/ | */ | ||||
* For checking the raw source code, use `seeInSource()`. | * For checking the raw source code, use `seeInSource()`. | ||||
* | * | ||||
* @param string $text | * @param string $text | ||||
* @param string $selector optional | |||||
* @param array|string $selector optional | |||||
* @see \Codeception\Lib\InnerBrowser::dontSee() | * @see \Codeception\Lib\InnerBrowser::dontSee() | ||||
*/ | */ | ||||
public function dontSee($text, $selector = null) { | public function dontSee($text, $selector = null) { | ||||
* ``` php | * ``` php | ||||
* <?php | * <?php | ||||
* // to match root url | * // to match root url | ||||
* $I->seeCurrentUrlMatches('~$/users/(\d+)~'); | |||||
* $I->seeCurrentUrlMatches('~^/users/(\d+)~'); | |||||
* ?> | * ?> | ||||
* ``` | * ``` | ||||
* | * | ||||
* ``` php | * ``` php | ||||
* <?php | * <?php | ||||
* // to match root url | * // to match root url | ||||
* $I->seeCurrentUrlMatches('~$/users/(\d+)~'); | |||||
* $I->seeCurrentUrlMatches('~^/users/(\d+)~'); | |||||
* ?> | * ?> | ||||
* ``` | * ``` | ||||
* | * | ||||
* ``` php | * ``` php | ||||
* <?php | * <?php | ||||
* // to match root url | * // to match root url | ||||
* $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~'); | |||||
* $I->dontSeeCurrentUrlMatches('~^/users/(\d+)~'); | |||||
* ?> | * ?> | ||||
* ``` | * ``` | ||||
* | * | ||||
* ``` php | * ``` php | ||||
* <?php | * <?php | ||||
* // to match root url | * // to match root url | ||||
* $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~'); | |||||
* $I->dontSeeCurrentUrlMatches('~^/users/(\d+)~'); | |||||
* ?> | * ?> | ||||
* ``` | * ``` | ||||
* | * | ||||
* | * | ||||
* ``` php | * ``` php | ||||
* <?php | * <?php | ||||
* $user_id = $I->grabFromCurrentUrl('~$/user/(\d+)/~'); | |||||
* $user_id = $I->grabFromCurrentUrl('~^/user/(\d+)/~'); | |||||
* $uri = $I->grabFromCurrentUrl(); | * $uri = $I->grabFromCurrentUrl(); | ||||
* ?> | * ?> | ||||
* ``` | * ``` | ||||
} | } | ||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that response code is between a certain range. Between actually means [from <= CODE <= to] | |||||
* | |||||
* @param $from | |||||
* @param $to | |||||
* Conditional Assertion: Test won't be stopped on fail | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsBetween() | |||||
*/ | |||||
public function canSeeResponseCodeIsBetween($from, $to) { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsBetween', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that response code is between a certain range. Between actually means [from <= CODE <= to] | |||||
* | |||||
* @param $from | |||||
* @param $to | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsBetween() | |||||
*/ | |||||
public function seeResponseCodeIsBetween($from, $to) { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsBetween', func_get_args())); | |||||
} | |||||
/** | /** | ||||
* [!] Method is generated. Documentation taken from corresponding module. | * [!] Method is generated. Documentation taken from corresponding module. | ||||
* | * | ||||
} | } | ||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code 2xx | |||||
* Conditional Assertion: Test won't be stopped on fail | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsSuccessful() | |||||
*/ | |||||
public function canSeeResponseCodeIsSuccessful() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsSuccessful', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code 2xx | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsSuccessful() | |||||
*/ | |||||
public function seeResponseCodeIsSuccessful() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsSuccessful', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code 3xx | |||||
* Conditional Assertion: Test won't be stopped on fail | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsRedirection() | |||||
*/ | |||||
public function canSeeResponseCodeIsRedirection() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsRedirection', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code 3xx | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsRedirection() | |||||
*/ | |||||
public function seeResponseCodeIsRedirection() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsRedirection', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code is 4xx | |||||
* Conditional Assertion: Test won't be stopped on fail | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsClientError() | |||||
*/ | |||||
public function canSeeResponseCodeIsClientError() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsClientError', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code is 4xx | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsClientError() | |||||
*/ | |||||
public function seeResponseCodeIsClientError() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsClientError', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code is 5xx | |||||
* Conditional Assertion: Test won't be stopped on fail | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsServerError() | |||||
*/ | |||||
public function canSeeResponseCodeIsServerError() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsServerError', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code is 5xx | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsServerError() | |||||
*/ | |||||
public function seeResponseCodeIsServerError() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsServerError', func_get_args())); | |||||
} | |||||
/** | /** | ||||
* [!] Method is generated. Documentation taken from corresponding module. | * [!] Method is generated. Documentation taken from corresponding module. | ||||
* | * | ||||
public function fixtures() { | public function fixtures() { | ||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('fixtures', func_get_args())); | return $this->getScenario()->runStep(new \Codeception\Step\Action('fixtures', func_get_args())); | ||||
} | } | ||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Initialize the fixtures. | |||||
* @since 2.0.12 | |||||
* @see \tests\codeception\common\_support\FixtureHelper::initFixtures() | |||||
*/ | |||||
public function initFixtures() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('initFixtures', func_get_args())); | |||||
} | |||||
} | } |
<?php //[STAMP] a85b178d5498babfb5e8fbdbde4a9381 | |||||
<?php //[STAMP] 4504e1c6798573041028a69bcea3ae21 | |||||
namespace tests\codeception\frontend\_generated; | namespace tests\codeception\frontend\_generated; | ||||
// This class was automatically generated by build task | // This class was automatically generated by build task | ||||
* @param $component | * @param $component | ||||
* @return mixed | * @return mixed | ||||
* @throws ModuleException | * @throws ModuleException | ||||
* @deprecated in your tests you can use \Yii::$app directly. | |||||
* @see \Codeception\Module\Yii2::grabComponent() | * @see \Codeception\Module\Yii2::grabComponent() | ||||
*/ | */ | ||||
public function grabComponent($component) { | public function grabComponent($component) { | ||||
* [!] Method is generated. Documentation taken from corresponding module. | * [!] Method is generated. Documentation taken from corresponding module. | ||||
* | * | ||||
* Returns array of all sent email messages. | * Returns array of all sent email messages. | ||||
* Each message implements `yii\mail\Message` interface. | |||||
* Each message implements `yii\mail\MessageInterface` interface. | |||||
* Useful to perform additional checks using `Asserts` module: | * Useful to perform additional checks using `Asserts` module: | ||||
* | * | ||||
* ```php | * ```php | ||||
} | } | ||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Sets a cookie and, if validation is enabled, signs it. | |||||
* @param string $name The name of the cookie | |||||
* @param string $value The value of the cookie | |||||
* @param array $params Additional cookie params like `domain`, `path`, `expires` and `secure`. | |||||
* @see \Codeception\Module\Yii2::setCookie() | |||||
*/ | |||||
public function setCookie($name, $val, $params = null) { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('setCookie', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* This function creates the CSRF Cookie. | |||||
* @param string $val The value of the CSRF token | |||||
* @return string[] Returns an array containing the name of the CSRF param and the masked CSRF token. | |||||
* @see \Codeception\Module\Yii2::createAndSetCsrfCookie() | |||||
*/ | |||||
public function createAndSetCsrfCookie($val) { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('createAndSetCsrfCookie', func_get_args())); | |||||
} | |||||
/** | /** | ||||
* [!] Method is generated. Documentation taken from corresponding module. | * [!] Method is generated. Documentation taken from corresponding module. | ||||
* | * | ||||
* // CSS button | * // CSS button | ||||
* $I->click('#form input[type=submit]'); | * $I->click('#form input[type=submit]'); | ||||
* // XPath | * // XPath | ||||
* $I->click('//form/*[@type=submit]'); | |||||
* $I->click('//form/*[@type="submit"]'); | |||||
* // link in context | * // link in context | ||||
* $I->click('Logout', '#nav'); | * $I->click('Logout', '#nav'); | ||||
* // using strict locator | * // using strict locator | ||||
* For checking the raw source code, use `seeInSource()`. | * For checking the raw source code, use `seeInSource()`. | ||||
* | * | ||||
* @param string $text | * @param string $text | ||||
* @param string $selector optional | |||||
* @param array|string $selector optional | |||||
* Conditional Assertion: Test won't be stopped on fail | * Conditional Assertion: Test won't be stopped on fail | ||||
* @see \Codeception\Lib\InnerBrowser::see() | * @see \Codeception\Lib\InnerBrowser::see() | ||||
*/ | */ | ||||
* For checking the raw source code, use `seeInSource()`. | * For checking the raw source code, use `seeInSource()`. | ||||
* | * | ||||
* @param string $text | * @param string $text | ||||
* @param string $selector optional | |||||
* @param array|string $selector optional | |||||
* @see \Codeception\Lib\InnerBrowser::see() | * @see \Codeception\Lib\InnerBrowser::see() | ||||
*/ | */ | ||||
public function see($text, $selector = null) { | public function see($text, $selector = null) { | ||||
* For checking the raw source code, use `seeInSource()`. | * For checking the raw source code, use `seeInSource()`. | ||||
* | * | ||||
* @param string $text | * @param string $text | ||||
* @param string $selector optional | |||||
* @param array|string $selector optional | |||||
* Conditional Assertion: Test won't be stopped on fail | * Conditional Assertion: Test won't be stopped on fail | ||||
* @see \Codeception\Lib\InnerBrowser::dontSee() | * @see \Codeception\Lib\InnerBrowser::dontSee() | ||||
*/ | */ | ||||
* For checking the raw source code, use `seeInSource()`. | * For checking the raw source code, use `seeInSource()`. | ||||
* | * | ||||
* @param string $text | * @param string $text | ||||
* @param string $selector optional | |||||
* @param array|string $selector optional | |||||
* @see \Codeception\Lib\InnerBrowser::dontSee() | * @see \Codeception\Lib\InnerBrowser::dontSee() | ||||
*/ | */ | ||||
public function dontSee($text, $selector = null) { | public function dontSee($text, $selector = null) { | ||||
* ``` php | * ``` php | ||||
* <?php | * <?php | ||||
* // to match root url | * // to match root url | ||||
* $I->seeCurrentUrlMatches('~$/users/(\d+)~'); | |||||
* $I->seeCurrentUrlMatches('~^/users/(\d+)~'); | |||||
* ?> | * ?> | ||||
* ``` | * ``` | ||||
* | * | ||||
* ``` php | * ``` php | ||||
* <?php | * <?php | ||||
* // to match root url | * // to match root url | ||||
* $I->seeCurrentUrlMatches('~$/users/(\d+)~'); | |||||
* $I->seeCurrentUrlMatches('~^/users/(\d+)~'); | |||||
* ?> | * ?> | ||||
* ``` | * ``` | ||||
* | * | ||||
* ``` php | * ``` php | ||||
* <?php | * <?php | ||||
* // to match root url | * // to match root url | ||||
* $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~'); | |||||
* $I->dontSeeCurrentUrlMatches('~^/users/(\d+)~'); | |||||
* ?> | * ?> | ||||
* ``` | * ``` | ||||
* | * | ||||
* ``` php | * ``` php | ||||
* <?php | * <?php | ||||
* // to match root url | * // to match root url | ||||
* $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~'); | |||||
* $I->dontSeeCurrentUrlMatches('~^/users/(\d+)~'); | |||||
* ?> | * ?> | ||||
* ``` | * ``` | ||||
* | * | ||||
* | * | ||||
* ``` php | * ``` php | ||||
* <?php | * <?php | ||||
* $user_id = $I->grabFromCurrentUrl('~$/user/(\d+)/~'); | |||||
* $user_id = $I->grabFromCurrentUrl('~^/user/(\d+)/~'); | |||||
* $uri = $I->grabFromCurrentUrl(); | * $uri = $I->grabFromCurrentUrl(); | ||||
* ?> | * ?> | ||||
* ``` | * ``` | ||||
} | } | ||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Sets a cookie with the given name and value. | |||||
* You can set additional cookie params like `domain`, `path`, `expires`, `secure` in array passed as last argument. | |||||
* | |||||
* ``` php | |||||
* <?php | |||||
* $I->setCookie('PHPSESSID', 'el4ukv0kqbvoirg7nkp4dncpk3'); | |||||
* ?> | |||||
* ``` | |||||
* | |||||
* @param $name | |||||
* @param $val | |||||
* @param array $params | |||||
* | |||||
* @return mixed | |||||
* @see \Codeception\Lib\InnerBrowser::setCookie() | |||||
*/ | |||||
public function setCookie($name, $val, $params = null) { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('setCookie', func_get_args())); | |||||
} | |||||
/** | /** | ||||
* [!] Method is generated. Documentation taken from corresponding module. | * [!] Method is generated. Documentation taken from corresponding module. | ||||
* | * | ||||
} | } | ||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that response code is between a certain range. Between actually means [from <= CODE <= to] | |||||
* | |||||
* @param $from | |||||
* @param $to | |||||
* Conditional Assertion: Test won't be stopped on fail | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsBetween() | |||||
*/ | |||||
public function canSeeResponseCodeIsBetween($from, $to) { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsBetween', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that response code is between a certain range. Between actually means [from <= CODE <= to] | |||||
* | |||||
* @param $from | |||||
* @param $to | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsBetween() | |||||
*/ | |||||
public function seeResponseCodeIsBetween($from, $to) { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsBetween', func_get_args())); | |||||
} | |||||
/** | /** | ||||
* [!] Method is generated. Documentation taken from corresponding module. | * [!] Method is generated. Documentation taken from corresponding module. | ||||
* | * | ||||
} | } | ||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code 2xx | |||||
* Conditional Assertion: Test won't be stopped on fail | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsSuccessful() | |||||
*/ | |||||
public function canSeeResponseCodeIsSuccessful() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsSuccessful', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code 2xx | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsSuccessful() | |||||
*/ | |||||
public function seeResponseCodeIsSuccessful() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsSuccessful', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code 3xx | |||||
* Conditional Assertion: Test won't be stopped on fail | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsRedirection() | |||||
*/ | |||||
public function canSeeResponseCodeIsRedirection() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsRedirection', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code 3xx | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsRedirection() | |||||
*/ | |||||
public function seeResponseCodeIsRedirection() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsRedirection', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code is 4xx | |||||
* Conditional Assertion: Test won't be stopped on fail | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsClientError() | |||||
*/ | |||||
public function canSeeResponseCodeIsClientError() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsClientError', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code is 4xx | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsClientError() | |||||
*/ | |||||
public function seeResponseCodeIsClientError() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsClientError', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code is 5xx | |||||
* Conditional Assertion: Test won't be stopped on fail | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsServerError() | |||||
*/ | |||||
public function canSeeResponseCodeIsServerError() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsServerError', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code is 5xx | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsServerError() | |||||
*/ | |||||
public function seeResponseCodeIsServerError() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsServerError', func_get_args())); | |||||
} | |||||
/** | /** | ||||
* [!] Method is generated. Documentation taken from corresponding module. | * [!] Method is generated. Documentation taken from corresponding module. | ||||
* | * | ||||
public function fixtures() { | public function fixtures() { | ||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('fixtures', func_get_args())); | return $this->getScenario()->runStep(new \Codeception\Step\Action('fixtures', func_get_args())); | ||||
} | } | ||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Initialize the fixtures. | |||||
* @since 2.0.12 | |||||
* @see \tests\codeception\common\_support\FixtureHelper::initFixtures() | |||||
*/ | |||||
public function initFixtures() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('initFixtures', func_get_args())); | |||||
} | |||||
} | } |
<?php //[STAMP] ed4d8cdd8d9d71e1210063b99c8b8445 | |||||
<?php //[STAMP] e543475a72b3c2b2bbb166e62bf94035 | |||||
namespace tests\codeception\frontend\_generated; | namespace tests\codeception\frontend\_generated; | ||||
// This class was automatically generated by build task | // This class was automatically generated by build task |
<?php | |||||
use tests\codeception\frontend\AcceptanceTester; | |||||
use tests\codeception\frontend\_pages\AboutPage; | |||||
/* @var $scenario Codeception\Scenario */ | |||||
$I = new AcceptanceTester($scenario); | |||||
$I->wantTo('ensure that about works'); | |||||
AboutPage::openBy($I); | |||||
$I->see('About', 'h1'); |
<?php | |||||
use tests\codeception\frontend\AcceptanceTester; | |||||
use tests\codeception\frontend\_pages\ContactPage; | |||||
/* @var $scenario Codeception\Scenario */ | |||||
$I = new AcceptanceTester($scenario); | |||||
$I->wantTo('ensure that contact works'); | |||||
$contactPage = ContactPage::openBy($I); | |||||
$I->see('Contact', 'h1'); | |||||
$I->amGoingTo('submit contact form with no data'); | |||||
$contactPage->submit([]); | |||||
if (method_exists($I, 'wait')) { | |||||
$I->wait(3); // only for selenium | |||||
} | |||||
$I->expectTo('see validations errors'); | |||||
$I->see('Contact', 'h1'); | |||||
$I->see('Name cannot be blank', '.help-block'); | |||||
$I->see('Email cannot be blank', '.help-block'); | |||||
$I->see('Subject cannot be blank', '.help-block'); | |||||
$I->see('Body cannot be blank', '.help-block'); | |||||
$I->see('The verification code is incorrect', '.help-block'); | |||||
$I->amGoingTo('submit contact form with not correct email'); | |||||
$contactPage->submit([ | |||||
'name' => 'tester', | |||||
'email' => 'tester.email', | |||||
'subject' => 'test subject', | |||||
'body' => 'test content', | |||||
'verifyCode' => 'testme', | |||||
]); | |||||
if (method_exists($I, 'wait')) { | |||||
$I->wait(3); // only for selenium | |||||
} | |||||
$I->expectTo('see that email adress is wrong'); | |||||
$I->dontSee('Name cannot be blank', '.help-block'); | |||||
$I->see('Email is not a valid email address.', '.help-block'); | |||||
$I->dontSee('Subject cannot be blank', '.help-block'); | |||||
$I->dontSee('Body cannot be blank', '.help-block'); | |||||
$I->dontSee('The verification code is incorrect', '.help-block'); | |||||
$I->amGoingTo('submit contact form with correct data'); | |||||
$contactPage->submit([ | |||||
'name' => 'tester', | |||||
'email' => 'tester@example.com', | |||||
'subject' => 'test subject', | |||||
'body' => 'test content', | |||||
'verifyCode' => 'testme', | |||||
]); | |||||
if (method_exists($I, 'wait')) { | |||||
$I->wait(3); // only for selenium | |||||
} | |||||
$I->see('Thank you for contacting us. We will respond to you as soon as possible.'); |
<?php | |||||
use tests\codeception\frontend\AcceptanceTester; | |||||
/* @var $scenario Codeception\Scenario */ | |||||
$I = new AcceptanceTester($scenario); | |||||
$I->wantTo('ensure that home page works'); | |||||
$I->amOnPage(Yii::$app->homeUrl); | |||||
$I->see('My Company'); | |||||
$I->seeLink('About'); | |||||
$I->click('About'); | |||||
$I->see('This is the About page.'); |
<?php | |||||
use tests\codeception\frontend\AcceptanceTester; | |||||
use tests\codeception\common\_pages\LoginPage; | |||||
/* @var $scenario Codeception\Scenario */ | |||||
$I = new AcceptanceTester($scenario); | |||||
$I->wantTo('ensure login page works'); | |||||
$loginPage = LoginPage::openBy($I); | |||||
$I->amGoingTo('submit login form with no data'); | |||||
$loginPage->login('', ''); | |||||
$I->expectTo('see validations errors'); | |||||
$I->see('Username cannot be blank.', '.help-block'); | |||||
$I->see('Password cannot be blank.', '.help-block'); | |||||
$I->amGoingTo('try to login with wrong credentials'); | |||||
$I->expectTo('see validations errors'); | |||||
$loginPage->login('admin', 'wrong'); | |||||
$I->expectTo('see validations errors'); | |||||
$I->see('Incorrect username or password.', '.help-block'); | |||||
$I->amGoingTo('try to login with correct credentials'); | |||||
$loginPage->login('erau', 'password_0'); | |||||
$I->expectTo('see that user is logged'); | |||||
$I->seeLink('Logout (erau)'); | |||||
$I->dontSeeLink('Login'); | |||||
$I->dontSeeLink('Signup'); | |||||
/** Uncomment if using WebDriver | |||||
* $I->click('Logout (erau)'); | |||||
* $I->dontSeeLink('Logout (erau)'); | |||||
* $I->seeLink('Login'); | |||||
*/ |
<?php | |||||
namespace tests\codeception\frontend\acceptance; | |||||
use tests\codeception\frontend\_pages\SignupPage; | |||||
use common\models\UserModel; | |||||
class SignupCest | |||||
{ | |||||
/** | |||||
* This method is called before each cest class test method | |||||
* @param \Codeception\Event\TestEvent $event | |||||
*/ | |||||
public function _before($event) | |||||
{ | |||||
} | |||||
/** | |||||
* This method is called after each cest class test method, even if test failed. | |||||
* @param \Codeception\Event\TestEvent $event | |||||
*/ | |||||
public function _after($event) | |||||
{ | |||||
UserModel::deleteAll([ | |||||
'email' => 'tester.email@example.com', | |||||
'username' => 'tester', | |||||
]); | |||||
} | |||||
/** | |||||
* This method is called when test fails. | |||||
* @param \Codeception\Event\FailEvent $event | |||||
*/ | |||||
public function _fail($event) | |||||
{ | |||||
} | |||||
/** | |||||
* @param \codeception_frontend\AcceptanceTester $I | |||||
* @param \Codeception\Scenario $scenario | |||||
*/ | |||||
public function testUserSignup($I, $scenario) | |||||
{ | |||||
$I->wantTo('ensure that signup works'); | |||||
$signupPage = SignupPage::openBy($I); | |||||
$I->see('Signup', 'h1'); | |||||
$I->see('Please fill out the following fields to signup:'); | |||||
$I->amGoingTo('submit signup form with no data'); | |||||
$signupPage->submit([]); | |||||
$I->expectTo('see validation errors'); | |||||
$I->see('Username cannot be blank.', '.help-block'); | |||||
$I->see('Email cannot be blank.', '.help-block'); | |||||
$I->see('Password cannot be blank.', '.help-block'); | |||||
$I->amGoingTo('submit signup form with not correct email'); | |||||
$signupPage->submit([ | |||||
'username' => 'tester', | |||||
'email' => 'tester.email', | |||||
'password' => 'tester_password', | |||||
]); | |||||
$I->expectTo('see that email address is wrong'); | |||||
$I->dontSee('Username cannot be blank.', '.help-block'); | |||||
$I->dontSee('Password cannot be blank.', '.help-block'); | |||||
$I->see('Email is not a valid email address.', '.help-block'); | |||||
$I->amGoingTo('submit signup form with correct email'); | |||||
$signupPage->submit([ | |||||
'username' => 'tester', | |||||
'email' => 'tester.email@example.com', | |||||
'password' => 'tester_password', | |||||
]); | |||||
$I->expectTo('see that user logged in'); | |||||
$I->seeLink('Logout (tester)'); | |||||
} | |||||
} |
<?php | |||||
use tests\codeception\frontend\FunctionalTester; | |||||
use tests\codeception\frontend\_pages\ContactPage; | |||||
/* @var $scenario Codeception\Scenario */ | |||||
$I = new FunctionalTester($scenario); | |||||
$I->wantTo('ensure that contact works'); | |||||
$contactPage = ContactPage::openBy($I); | |||||
$I->see('Contact', 'h1'); | |||||
$I->amGoingTo('submit contact form with no data'); | |||||
$contactPage->submit([]); | |||||
$I->expectTo('see validations errors'); | |||||
$I->see('Contact', 'h1'); | |||||
$I->see('Name cannot be blank', '.help-block'); | |||||
$I->see('Email cannot be blank', '.help-block'); | |||||
$I->see('Subject cannot be blank', '.help-block'); | |||||
$I->see('Body cannot be blank', '.help-block'); | |||||
$I->see('The verification code is incorrect', '.help-block'); | |||||
$I->amGoingTo('submit contact form with not correct email'); | |||||
$contactPage->submit([ | |||||
'name' => 'tester', | |||||
'email' => 'tester.email', | |||||
'subject' => 'test subject', | |||||
'body' => 'test content', | |||||
'verifyCode' => 'testme', | |||||
]); | |||||
$I->expectTo('see that email adress is wrong'); | |||||
$I->dontSee('Name cannot be blank', '.help-block'); | |||||
$I->see('Email is not a valid email address.', '.help-block'); | |||||
$I->dontSee('Subject cannot be blank', '.help-block'); | |||||
$I->dontSee('Body cannot be blank', '.help-block'); | |||||
$I->dontSee('The verification code is incorrect', '.help-block'); | |||||
$I->amGoingTo('submit contact form with correct data'); | |||||
$contactPage->submit([ | |||||
'name' => 'tester', | |||||
'email' => 'tester@example.com', | |||||
'subject' => 'test subject', | |||||
'body' => 'test content', | |||||
'verifyCode' => 'testme', | |||||
]); | |||||
$I->see('Thank you for contacting us. We will respond to you as soon as possible.'); |
/* @var $scenario Codeception\Scenario */ | /* @var $scenario Codeception\Scenario */ | ||||
$I = new FunctionalTester($scenario); | $I = new FunctionalTester($scenario); | ||||
$I->wantTo('ensure that home page works'); | |||||
$I->amOnPage(Yii::$app->homeUrl); | |||||
$I->see('My Company'); | |||||
$I->seeLink('About'); | |||||
$I->click('About'); | |||||
$I->see('This is the About page.'); | |||||
$I->wantTo("Page d'accueil"); | |||||
$I->amOnPage('site/index'); | |||||
$I->see('distribution'); |
<?php | |||||
use tests\codeception\frontend\FunctionalTester; | |||||
use tests\codeception\common\_pages\LoginPage; | |||||
/* @var $scenario Codeception\Scenario */ | |||||
$I = new FunctionalTester($scenario); | |||||
$I->wantTo('ensure login page works'); | |||||
$loginPage = LoginPage::openBy($I); | |||||
$I->amGoingTo('submit login form with no data'); | |||||
$loginPage->login('', ''); | |||||
$I->expectTo('see validations errors'); | |||||
$I->see('Username cannot be blank.', '.help-block'); | |||||
$I->see('Password cannot be blank.', '.help-block'); | |||||
$I->amGoingTo('try to login with wrong credentials'); | |||||
$I->expectTo('see validations errors'); | |||||
$loginPage->login('admin', 'wrong'); | |||||
$I->expectTo('see validations errors'); | |||||
$I->see('Incorrect username or password.', '.help-block'); | |||||
$I->amGoingTo('try to login with correct credentials'); | |||||
$loginPage->login('erau', 'password_0'); | |||||
$I->expectTo('see that user is logged'); | |||||
$I->seeLink('Logout (erau)'); | |||||
$I->dontSeeLink('Login'); | |||||
$I->dontSeeLink('Signup'); |
<?php | <?php | ||||
use tests\codeception\frontend\FunctionalTester; | use tests\codeception\frontend\FunctionalTester; | ||||
use tests\codeception\frontend\_pages\AboutPage; | |||||
/* @var $scenario Codeception\Scenario */ | /* @var $scenario Codeception\Scenario */ | ||||
$I = new FunctionalTester($scenario); | $I = new FunctionalTester($scenario); | ||||
$I->wantTo('ensure that about works'); | |||||
AboutPage::openBy($I); | |||||
$I->see('About', 'h1'); | |||||
$I->wantTo("Liste des producteurs"); | |||||
$I->amOnPage('site/producers'); | |||||
$I->see('Producteurs', 'h1'); |
<?php | |||||
namespace tests\codeception\frontend\functional; | |||||
use tests\codeception\frontend\_pages\SignupPage; | |||||
use common\models\UserModel; | |||||
class SignupCest | |||||
{ | |||||
/** | |||||
* This method is called before each cest class test method | |||||
* @param \Codeception\Event\TestEvent $event | |||||
*/ | |||||
public function _before($event) | |||||
{ | |||||
} | |||||
/** | |||||
* This method is called after each cest class test method, even if test failed. | |||||
* @param \Codeception\Event\TestEvent $event | |||||
*/ | |||||
public function _after($event) | |||||
{ | |||||
UserModel::deleteAll([ | |||||
'email' => 'tester.email@example.com', | |||||
'username' => 'tester', | |||||
]); | |||||
} | |||||
/** | |||||
* This method is called when test fails. | |||||
* @param \Codeception\Event\FailEvent $event | |||||
*/ | |||||
public function _fail($event) | |||||
{ | |||||
} | |||||
/** | |||||
* | |||||
* @param \codeception_frontend\FunctionalTester $I | |||||
* @param \Codeception\Scenario $scenario | |||||
*/ | |||||
public function testUserSignup($I, $scenario) | |||||
{ | |||||
$I->wantTo('ensure that signup works'); | |||||
$signupPage = SignupPage::openBy($I); | |||||
$I->see('Signup', 'h1'); | |||||
$I->see('Please fill out the following fields to signup:'); | |||||
$I->amGoingTo('submit signup form with no data'); | |||||
$signupPage->submit([]); | |||||
$I->expectTo('see validation errors'); | |||||
$I->see('Username cannot be blank.', '.help-block'); | |||||
$I->see('Email cannot be blank.', '.help-block'); | |||||
$I->see('Password cannot be blank.', '.help-block'); | |||||
$I->amGoingTo('submit signup form with not correct email'); | |||||
$signupPage->submit([ | |||||
'username' => 'tester', | |||||
'email' => 'tester.email', | |||||
'password' => 'tester_password', | |||||
]); | |||||
$I->expectTo('see that email address is wrong'); | |||||
$I->dontSee('Username cannot be blank.', '.help-block'); | |||||
$I->dontSee('Password cannot be blank.', '.help-block'); | |||||
$I->see('Email is not a valid email address.', '.help-block'); | |||||
$I->amGoingTo('submit signup form with correct email'); | |||||
$signupPage->submit([ | |||||
'username' => 'tester', | |||||
'email' => 'tester.email@example.com', | |||||
'password' => 'tester_password', | |||||
]); | |||||
$I->expectTo('see that user is created'); | |||||
$I->seeRecord('common\models\UserModel', [ | |||||
'username' => 'tester', | |||||
'email' => 'tester.email@example.com', | |||||
]); | |||||
$I->expectTo('see that user logged in'); | |||||
$I->seeLink('Logout (tester)'); | |||||
} | |||||
} |
<?php | |||||
namespace tests\codeception\frontend\unit\models; | |||||
use Yii; | |||||
use tests\codeception\frontend\unit\TestCase; | |||||
use frontend\models\ContactForm; | |||||
class ContactFormTest extends TestCase | |||||
{ | |||||
use \Codeception\Specify; | |||||
protected function setUp() | |||||
{ | |||||
parent::setUp(); | |||||
Yii::$app->mailer->fileTransportCallback = function ($mailer, $message) { | |||||
return 'testing_message.eml'; | |||||
}; | |||||
} | |||||
protected function tearDown() | |||||
{ | |||||
unlink($this->getMessageFile()); | |||||
parent::tearDown(); | |||||
} | |||||
public function testContact() | |||||
{ | |||||
$model = new ContactForm(); | |||||
$model->attributes = [ | |||||
'name' => 'Tester', | |||||
'email' => 'tester@example.com', | |||||
'subject' => 'very important letter subject', | |||||
'body' => 'body of current message', | |||||
]; | |||||
$model->sendEmail('admin@example.com'); | |||||
$this->specify('email should be send', function () { | |||||
expect('email file should exist', file_exists($this->getMessageFile()))->true(); | |||||
}); | |||||
$this->specify('message should contain correct data', function () use ($model) { | |||||
$emailMessage = file_get_contents($this->getMessageFile()); | |||||
expect('email should contain user name', $emailMessage)->contains($model->name); | |||||
expect('email should contain sender email', $emailMessage)->contains($model->email); | |||||
expect('email should contain subject', $emailMessage)->contains($model->subject); | |||||
expect('email should contain body', $emailMessage)->contains($model->body); | |||||
}); | |||||
} | |||||
private function getMessageFile() | |||||
{ | |||||
return Yii::getAlias(Yii::$app->mailer->fileTransportPath) . '/testing_message.eml'; | |||||
} | |||||
} |
<?php | |||||
namespace tests\codeception\frontend\models; | |||||
use Yii; | |||||
use tests\codeception\frontend\unit\DbTestCase; | |||||
use frontend\models\PasswordResetRequestForm; | |||||
use tests\codeception\common\fixtures\UserFixture; | |||||
use common\models\UserModel; | |||||
use Codeception\Specify; | |||||
class PasswordResetRequestFormTest extends DbTestCase | |||||
{ | |||||
use Specify; | |||||
protected function setUp() | |||||
{ | |||||
parent::setUp(); | |||||
Yii::$app->mailer->fileTransportCallback = function ($mailer, $message) { | |||||
return 'testing_message.eml'; | |||||
}; | |||||
} | |||||
protected function tearDown() | |||||
{ | |||||
@unlink($this->getMessageFile()); | |||||
parent::tearDown(); | |||||
} | |||||
public function testSendEmailWrongUser() | |||||
{ | |||||
$this->specify('no user with such email, message should not be send', function () { | |||||
$model = new PasswordResetRequestForm(); | |||||
$model->email = 'not-existing-email@example.com'; | |||||
expect('email not send', $model->sendEmail())->false(); | |||||
}); | |||||
$this->specify('user is not active, message should not be send', function () { | |||||
$model = new PasswordResetRequestForm(); | |||||
$model->email = $this->user[1]['email']; | |||||
expect('email not send', $model->sendEmail())->false(); | |||||
}); | |||||
} | |||||
public function testSendEmailCorrectUser() | |||||
{ | |||||
$model = new PasswordResetRequestForm(); | |||||
$model->email = $this->user[0]['email']; | |||||
$user = UserModel::findOne(['password_reset_token' => $this->user[0]['password_reset_token']]); | |||||
expect('email sent', $model->sendEmail())->true(); | |||||
expect('user has valid token', $user->password_reset_token)->notNull(); | |||||
$this->specify('message has correct format', function () use ($model) { | |||||
expect('message file exists', file_exists($this->getMessageFile()))->true(); | |||||
$message = file_get_contents($this->getMessageFile()); | |||||
expect('message "from" is correct', $message)->contains(Yii::$app->params['supportEmail']); | |||||
expect('message "to" is correct', $message)->contains($model->email); | |||||
}); | |||||
} | |||||
public function fixtures() | |||||
{ | |||||
return [ | |||||
'user' => [ | |||||
'class' => UserFixture::className(), | |||||
'dataFile' => '@tests/codeception/frontend/unit/fixtures/data/models/user.php' | |||||
], | |||||
]; | |||||
} | |||||
private function getMessageFile() | |||||
{ | |||||
return Yii::getAlias(Yii::$app->mailer->fileTransportPath) . '/testing_message.eml'; | |||||
} | |||||
} |
<?php | |||||
namespace tests\codeception\frontend\unit\models; | |||||
use tests\codeception\frontend\unit\DbTestCase; | |||||
use tests\codeception\common\fixtures\UserFixture; | |||||
use frontend\models\ResetPasswordForm; | |||||
class ResetPasswordFormTest extends DbTestCase | |||||
{ | |||||
/** | |||||
* @expectedException \yii\base\InvalidParamException | |||||
*/ | |||||
public function testResetWrongToken() | |||||
{ | |||||
new ResetPasswordForm('notexistingtoken_1391882543'); | |||||
} | |||||
/** | |||||
* @expectedException \yii\base\InvalidParamException | |||||
*/ | |||||
public function testResetEmptyToken() | |||||
{ | |||||
new ResetPasswordForm(''); | |||||
} | |||||
public function testResetCorrectToken() | |||||
{ | |||||
$form = new ResetPasswordForm($this->user[0]['password_reset_token']); | |||||
expect('password should be resetted', $form->resetPassword())->true(); | |||||
} | |||||
public function fixtures() | |||||
{ | |||||
return [ | |||||
'user' => [ | |||||
'class' => UserFixture::className(), | |||||
'dataFile' => '@tests/codeception/frontend/unit/fixtures/data/models/user.php' | |||||
], | |||||
]; | |||||
} | |||||
} |
<?php | |||||
namespace tests\codeception\frontend\unit\models; | |||||
use tests\codeception\frontend\unit\DbTestCase; | |||||
use tests\codeception\common\fixtures\UserFixture; | |||||
use Codeception\Specify; | |||||
use frontend\models\SignupForm; | |||||
class SignupFormTest extends DbTestCase | |||||
{ | |||||
use Specify; | |||||
public function testCorrectSignup() | |||||
{ | |||||
$model = new SignupForm([ | |||||
'username' => 'some_username', | |||||
'email' => 'some_email@example.com', | |||||
'password' => 'some_password', | |||||
]); | |||||
$user = $model->signup(); | |||||
$this->assertInstanceOf('common\models\UserModel', $user, 'user should be valid'); | |||||
expect('username should be correct', $user->username)->equals('some_username'); | |||||
expect('email should be correct', $user->email)->equals('some_email@example.com'); | |||||
expect('password should be correct', $user->validatePassword('some_password'))->true(); | |||||
} | |||||
public function testNotCorrectSignup() | |||||
{ | |||||
$model = new SignupForm([ | |||||
'username' => 'troy.becker', | |||||
'email' => 'nicolas.dianna@hotmail.com', | |||||
'password' => 'some_password', | |||||
]); | |||||
expect('username and email are in use, user should not be created', $model->signup())->null(); | |||||
} | |||||
public function fixtures() | |||||
{ | |||||
return [ | |||||
'user' => [ | |||||
'class' => UserFixture::className(), | |||||
'dataFile' => '@tests/codeception/frontend/unit/fixtures/data/models/user.php', | |||||
], | |||||
]; | |||||
} | |||||
} |
<?php //[STAMP] b87684f4c0c75fc41e1f8fbea925ed7e | |||||
<?php //[STAMP] f5e217e705497504e225283d7e1648a2 | |||||
namespace _generated; | namespace _generated; | ||||
// This class was automatically generated by build task | // This class was automatically generated by build task | ||||
* // CSS button | * // CSS button | ||||
* $I->click('#form input[type=submit]'); | * $I->click('#form input[type=submit]'); | ||||
* // XPath | * // XPath | ||||
* $I->click('//form/*[@type=submit]'); | |||||
* $I->click('//form/*[@type="submit"]'); | |||||
* // link in context | * // link in context | ||||
* $I->click('Logout', '#nav'); | * $I->click('Logout', '#nav'); | ||||
* // using strict locator | * // using strict locator | ||||
* For checking the raw source code, use `seeInSource()`. | * For checking the raw source code, use `seeInSource()`. | ||||
* | * | ||||
* @param string $text | * @param string $text | ||||
* @param string $selector optional | |||||
* @param array|string $selector optional | |||||
* Conditional Assertion: Test won't be stopped on fail | * Conditional Assertion: Test won't be stopped on fail | ||||
* @see \Codeception\Lib\InnerBrowser::see() | * @see \Codeception\Lib\InnerBrowser::see() | ||||
*/ | */ | ||||
* For checking the raw source code, use `seeInSource()`. | * For checking the raw source code, use `seeInSource()`. | ||||
* | * | ||||
* @param string $text | * @param string $text | ||||
* @param string $selector optional | |||||
* @param array|string $selector optional | |||||
* @see \Codeception\Lib\InnerBrowser::see() | * @see \Codeception\Lib\InnerBrowser::see() | ||||
*/ | */ | ||||
public function see($text, $selector = null) { | public function see($text, $selector = null) { | ||||
* For checking the raw source code, use `seeInSource()`. | * For checking the raw source code, use `seeInSource()`. | ||||
* | * | ||||
* @param string $text | * @param string $text | ||||
* @param string $selector optional | |||||
* @param array|string $selector optional | |||||
* Conditional Assertion: Test won't be stopped on fail | * Conditional Assertion: Test won't be stopped on fail | ||||
* @see \Codeception\Lib\InnerBrowser::dontSee() | * @see \Codeception\Lib\InnerBrowser::dontSee() | ||||
*/ | */ | ||||
* For checking the raw source code, use `seeInSource()`. | * For checking the raw source code, use `seeInSource()`. | ||||
* | * | ||||
* @param string $text | * @param string $text | ||||
* @param string $selector optional | |||||
* @param array|string $selector optional | |||||
* @see \Codeception\Lib\InnerBrowser::dontSee() | * @see \Codeception\Lib\InnerBrowser::dontSee() | ||||
*/ | */ | ||||
public function dontSee($text, $selector = null) { | public function dontSee($text, $selector = null) { | ||||
* ``` php | * ``` php | ||||
* <?php | * <?php | ||||
* // to match root url | * // to match root url | ||||
* $I->seeCurrentUrlMatches('~$/users/(\d+)~'); | |||||
* $I->seeCurrentUrlMatches('~^/users/(\d+)~'); | |||||
* ?> | * ?> | ||||
* ``` | * ``` | ||||
* | * | ||||
* ``` php | * ``` php | ||||
* <?php | * <?php | ||||
* // to match root url | * // to match root url | ||||
* $I->seeCurrentUrlMatches('~$/users/(\d+)~'); | |||||
* $I->seeCurrentUrlMatches('~^/users/(\d+)~'); | |||||
* ?> | * ?> | ||||
* ``` | * ``` | ||||
* | * | ||||
* ``` php | * ``` php | ||||
* <?php | * <?php | ||||
* // to match root url | * // to match root url | ||||
* $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~'); | |||||
* $I->dontSeeCurrentUrlMatches('~^/users/(\d+)~'); | |||||
* ?> | * ?> | ||||
* ``` | * ``` | ||||
* | * | ||||
* ``` php | * ``` php | ||||
* <?php | * <?php | ||||
* // to match root url | * // to match root url | ||||
* $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~'); | |||||
* $I->dontSeeCurrentUrlMatches('~^/users/(\d+)~'); | |||||
* ?> | * ?> | ||||
* ``` | * ``` | ||||
* | * | ||||
* | * | ||||
* ``` php | * ``` php | ||||
* <?php | * <?php | ||||
* $user_id = $I->grabFromCurrentUrl('~$/user/(\d+)/~'); | |||||
* $user_id = $I->grabFromCurrentUrl('~^/user/(\d+)/~'); | |||||
* $uri = $I->grabFromCurrentUrl(); | * $uri = $I->grabFromCurrentUrl(); | ||||
* ?> | * ?> | ||||
* ``` | * ``` | ||||
} | } | ||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that response code is between a certain range. Between actually means [from <= CODE <= to] | |||||
* | |||||
* @param $from | |||||
* @param $to | |||||
* Conditional Assertion: Test won't be stopped on fail | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsBetween() | |||||
*/ | |||||
public function canSeeResponseCodeIsBetween($from, $to) { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsBetween', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that response code is between a certain range. Between actually means [from <= CODE <= to] | |||||
* | |||||
* @param $from | |||||
* @param $to | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsBetween() | |||||
*/ | |||||
public function seeResponseCodeIsBetween($from, $to) { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsBetween', func_get_args())); | |||||
} | |||||
/** | /** | ||||
* [!] Method is generated. Documentation taken from corresponding module. | * [!] Method is generated. Documentation taken from corresponding module. | ||||
* | * | ||||
} | } | ||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code 2xx | |||||
* Conditional Assertion: Test won't be stopped on fail | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsSuccessful() | |||||
*/ | |||||
public function canSeeResponseCodeIsSuccessful() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsSuccessful', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code 2xx | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsSuccessful() | |||||
*/ | |||||
public function seeResponseCodeIsSuccessful() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsSuccessful', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code 3xx | |||||
* Conditional Assertion: Test won't be stopped on fail | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsRedirection() | |||||
*/ | |||||
public function canSeeResponseCodeIsRedirection() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsRedirection', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code 3xx | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsRedirection() | |||||
*/ | |||||
public function seeResponseCodeIsRedirection() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsRedirection', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code is 4xx | |||||
* Conditional Assertion: Test won't be stopped on fail | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsClientError() | |||||
*/ | |||||
public function canSeeResponseCodeIsClientError() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsClientError', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code is 4xx | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsClientError() | |||||
*/ | |||||
public function seeResponseCodeIsClientError() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsClientError', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code is 5xx | |||||
* Conditional Assertion: Test won't be stopped on fail | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsServerError() | |||||
*/ | |||||
public function canSeeResponseCodeIsServerError() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsServerError', func_get_args())); | |||||
} | |||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the response code is 5xx | |||||
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsServerError() | |||||
*/ | |||||
public function seeResponseCodeIsServerError() { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsServerError', func_get_args())); | |||||
} | |||||
/** | /** | ||||
* [!] Method is generated. Documentation taken from corresponding module. | * [!] Method is generated. Documentation taken from corresponding module. | ||||
* | * |
<?php //[STAMP] 87d7b73e5d70b2bf844f74223195c6a2 | |||||
<?php //[STAMP] 0070dbf1b3210bcb46043261c4e6eca0 | |||||
namespace _generated; | namespace _generated; | ||||
// This class was automatically generated by build task | // This class was automatically generated by build task |
<?php //[STAMP] d535fe5574036c99de30ed605e60bddb | |||||
<?php //[STAMP] c2c9446f63b7a0bf8b43e42b9b1b6f87 | |||||
namespace _generated; | namespace _generated; | ||||
// This class was automatically generated by build task | // This class was automatically generated by build task | ||||
* Regular example: | * Regular example: | ||||
* ```php | * ```php | ||||
* <?php | * <?php | ||||
* $I->assertEquals($element->getChildrenCount(), 5); | |||||
* $I->assertEquals(5, $element->getChildrenCount()); | |||||
* ``` | * ``` | ||||
* | * | ||||
* Floating-point example: | * Floating-point example: | ||||
* ```php | * ```php | ||||
* <?php | * <?php | ||||
* $I->assertEquals($calculator->add(0.1, 0.2), 0.3, 'Calculator should add the two numbers correctly.', 0.01); | |||||
* $I->assertEquals(0.3, $calculator->add(0.1, 0.2), 'Calculator should add the two numbers correctly.', 0.01); | |||||
* ``` | * ``` | ||||
* | * | ||||
* @param $expected | * @param $expected | ||||
* Regular example: | * Regular example: | ||||
* ```php | * ```php | ||||
* <?php | * <?php | ||||
* $I->assertNotEquals($element->getChildrenCount(), 0); | |||||
* $I->assertNotEquals(0, $element->getChildrenCount()); | |||||
* ``` | * ``` | ||||
* | * | ||||
* Floating-point example: | * Floating-point example: | ||||
* ```php | * ```php | ||||
* <?php | * <?php | ||||
* $I->assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the two numbers correctly.', 0.01); | |||||
* $I->assertNotEquals(0.4, $calculator->add(0.1, 0.2), 'Calculator should add the two numbers correctly.', 0.01); | |||||
* ``` | * ``` | ||||
* | * | ||||
* @param $expected | * @param $expected | ||||
} | } | ||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the condition is NOT true (everything but true) | |||||
* | |||||
* @param $condition | |||||
* @param string $message | |||||
* @see \Codeception\Module\Asserts::assertNotTrue() | |||||
*/ | |||||
public function assertNotTrue($condition, $message = null) { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotTrue', func_get_args())); | |||||
} | |||||
/** | /** | ||||
* [!] Method is generated. Documentation taken from corresponding module. | * [!] Method is generated. Documentation taken from corresponding module. | ||||
* | * | ||||
} | } | ||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Checks that the condition is NOT false (everything but false) | |||||
* | |||||
* @param $condition | |||||
* @param string $message | |||||
* @see \Codeception\Module\Asserts::assertNotFalse() | |||||
*/ | |||||
public function assertNotFalse($condition, $message = null) { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotFalse', func_get_args())); | |||||
} | |||||
/** | /** | ||||
* [!] Method is generated. Documentation taken from corresponding module. | * [!] Method is generated. Documentation taken from corresponding module. | ||||
* | * | ||||
* | * | ||||
* @param $exception string or \Exception | * @param $exception string or \Exception | ||||
* @param $callback | * @param $callback | ||||
* | |||||
* @deprecated Use expectThrowable instead | |||||
* @see \Codeception\Module\Asserts::expectException() | * @see \Codeception\Module\Asserts::expectException() | ||||
*/ | */ | ||||
public function expectException($exception, $callback) { | public function expectException($exception, $callback) { | ||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); | ||||
} | } | ||||
/** | |||||
* [!] Method is generated. Documentation taken from corresponding module. | |||||
* | |||||
* Handles and checks throwables (Exceptions/Errors) called inside the callback function. | |||||
* Either throwable class name or throwable instance should be provided. | |||||
* | |||||
* ```php | |||||
* <?php | |||||
* $I->expectThrowable(MyThrowable::class, function() { | |||||
* $this->doSomethingBad(); | |||||
* }); | |||||
* | |||||
* $I->expectThrowable(new MyException(), function() { | |||||
* $this->doSomethingBad(); | |||||
* }); | |||||
* ``` | |||||
* If you want to check message or throwable code, you can pass them with throwable instance: | |||||
* ```php | |||||
* <?php | |||||
* // will check that throwable MyError is thrown with "Don't do bad things" message | |||||
* $I->expectThrowable(new MyError("Don't do bad things"), function() { | |||||
* $this->doSomethingBad(); | |||||
* }); | |||||
* ``` | |||||
* | |||||
* @param $throwable string or \Throwable | |||||
* @param $callback | |||||
* @see \Codeception\Module\Asserts::expectThrowable() | |||||
*/ | |||||
public function expectThrowable($throwable, $callback) { | |||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('expectThrowable', func_get_args())); | |||||
} | |||||
} | } |
<?php | |||||
class MyNewScenarioCest | |||||
{ | |||||
public function _before(FunctionalTester $I) | |||||
{ | |||||
} | |||||
public function _after(FunctionalTester $I) | |||||
{ | |||||
} | |||||
// tests | |||||
public function tryToTest(FunctionalTester $I) | |||||
{ | |||||
$I->amOnPage(['site/contact']); | |||||
/*$I->submitForm('#contact-form', []); | |||||
$I->expectTo('see validations errors'); | |||||
$I->see('Contact', 'h1'); | |||||
$I->see('Name cannot be blank'); | |||||
$I->see('Email cannot be blank'); | |||||
$I->see('Subject cannot be blank'); | |||||
$I->see('Body cannot be blank');*/ | |||||
//$I->see('<h1>Contact</h1>'); | |||||
} | |||||
} |