diff --git a/.gitignore b/.gitignore index f2915a9..6482763 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,6 @@ composer.phar # Mac DS_Store Files .DS_Store + +# local phpunit config +/phpunit.xml \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 2add223..99ff95a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,9 @@ language: php php: - - 5.3 - 5.4 - 5.5 -env: - - CUBRID_VERSION=9.1.0 - services: - redis-server - memcached @@ -22,7 +18,7 @@ before_script: - tests/unit/data/travis/cubrid-setup.sh script: - - phpunit --coverage-clover tests/unit/runtime/coveralls/clover.xml --verbose --exclude-group mssql,oci,wincache,xcache,zenddata + - phpunit --coverage-clover tests/unit/runtime/coveralls/clover.xml --verbose --exclude-group mssql,oci,wincache,xcache,zenddata,vendor after_script: - php vendor/bin/coveralls diff --git a/LICENSE.md b/LICENSE.md index 6edcc4f..e98f03d 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,7 +1,7 @@ The Yii framework is free software. It is released under the terms of the following BSD License. -Copyright © 2008-2013 by Yii Software LLC (http://www.yiisoft.com) +Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com) All rights reserved. Redistribution and use in source and binary forms, with or without @@ -29,4 +29,4 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file +POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md index 1cd0121..3bc2d67 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ DIRECTORY STRUCTURE REQUIREMENTS ------------ -The minimum requirement by Yii is that your Web server supports PHP 5.3.?. +The minimum requirement by Yii is that your Web server supports PHP 5.4. DOCUMENTATION @@ -42,7 +42,7 @@ DOCUMENTATION For 1.1 users, you may refer to [Upgrading from Yii 1.1](docs/guide/upgrade-from-v1.md) to have a general idea of what has changed in 2.0. -We are writing more documentation to get you started and learn more in depth. +[Definitive Guide draft](docs/guide/index.md) is available. It's not complete yet but main parts are already OK. HOW TO PARTICIPATE diff --git a/apps/advanced/LICENSE.md b/apps/advanced/LICENSE.md index 6edcc4f..e98f03d 100644 --- a/apps/advanced/LICENSE.md +++ b/apps/advanced/LICENSE.md @@ -1,7 +1,7 @@ The Yii framework is free software. It is released under the terms of the following BSD License. -Copyright © 2008-2013 by Yii Software LLC (http://www.yiisoft.com) +Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com) All rights reserved. Redistribution and use in source and binary forms, with or without @@ -29,4 +29,4 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file +POSSIBILITY OF SUCH DAMAGE. diff --git a/apps/advanced/README.md b/apps/advanced/README.md index 6860c11..00beb56 100644 --- a/apps/advanced/README.md +++ b/apps/advanced/README.md @@ -52,7 +52,7 @@ environments/ contains environment-based overrides REQUIREMENTS ------------ -The minimum requirement by Yii is that your Web server supports PHP 5.3.?. +The minimum requirement by Yii is that your Web server supports PHP 5.4.0. In order for captcha to work you need either GD2 extension or ImageMagick PHP extension. @@ -76,6 +76,13 @@ php composer.phar create-project --stability=dev yiisoft/yii2-app-advanced yii-a Note that in order to install some dependencies you must have `php_openssl` extension enabled. +After the application is installed, switch to the project folder and run the following command +to initialize the application: + +~~~ +./init (init on Windows) +~~~ + ### Install from an Archive File @@ -103,9 +110,11 @@ GETTING STARTED After you install the application, you have to conduct the following steps to initialize the installed application. You only need to do these once for all. -1. Execute the `init` command and select `dev` as environment. +1. Execute the `init` command and select `dev` as environment. Alternatively you can execute it as `init --env=Development` +or `init --env=Production`. 2. Create a new database. It is assumed that MySQL InnoDB is used. If not, adjust `console/migrations/m130524_201442_init.php`. 3. In `common/config/params.php` set your database details in `components.db` values. +4. Apply migrations with `yii migrate`. Now you should be able to access: diff --git a/apps/advanced/backend/assets/.gitkeep b/apps/advanced/backend/assets/.gitkeep deleted file mode 100644 index 72e8ffc..0000000 --- a/apps/advanced/backend/assets/.gitkeep +++ /dev/null @@ -1 +0,0 @@ -* diff --git a/apps/advanced/frontend/config/AppAsset.php b/apps/advanced/backend/assets/AppAsset.php similarity index 75% rename from apps/advanced/frontend/config/AppAsset.php rename to apps/advanced/backend/assets/AppAsset.php index 4df653c..bd5c3a0 100644 --- a/apps/advanced/frontend/config/AppAsset.php +++ b/apps/advanced/backend/assets/AppAsset.php @@ -5,7 +5,7 @@ * @license http://www.yiiframework.com/license/ */ -namespace frontend\config; +namespace backend\assets; use yii\web\AssetBundle; @@ -17,13 +17,10 @@ class AppAsset extends AssetBundle { public $basePath = '@webroot'; public $baseUrl = '@web'; - public $css = array( - 'css/site.css', - ); - public $js = array( - ); - public $depends = array( + public $css = ['css/site.css']; + public $js = []; + public $depends = [ 'yii\web\YiiAsset', 'yii\bootstrap\BootstrapAsset', - ); + ]; } diff --git a/apps/advanced/backend/config/main.php b/apps/advanced/backend/config/main.php index 30c1825..f2745e2 100644 --- a/apps/advanced/backend/config/main.php +++ b/apps/advanced/backend/config/main.php @@ -1,5 +1,5 @@ 'app-backend', 'basePath' => dirname(__DIR__), - 'vendorPath' => dirname(dirname(__DIR__)) . '/vendor', - 'preload' => array('log'), + 'vendorPath' => $rootDir . '/vendor', + 'preload' => ['log'], 'controllerNamespace' => 'backend\controllers', - 'modules' => array( - ), - 'components' => array( - 'request' => array( + 'modules' => [], + 'extensions' => require($rootDir . '/vendor/yiisoft/extensions.php'), + 'components' => [ + 'request' => [ 'enableCsrfValidation' => true, - ), + ], 'db' => $params['components.db'], 'cache' => $params['components.cache'], - 'user' => array( + 'mail' => $params['components.mail'], + 'user' => [ 'identityClass' => 'common\models\User', - ), - 'log' => array( + ], + 'log' => [ 'traceLevel' => YII_DEBUG ? 3 : 0, - 'targets' => array( - array( + 'targets' => [ + [ 'class' => 'yii\log\FileTarget', - 'levels' => array('error', 'warning'), - ), - ), - ), - 'errorHandler' => array( + 'levels' => ['error', 'warning'], + ], + ], + ], + 'errorHandler' => [ 'errorAction' => 'site/error', - ), - ), + ], + ], 'params' => $params, -); +]; diff --git a/apps/advanced/backend/config/params.php b/apps/advanced/backend/config/params.php index 1643a70..0e625dc 100644 --- a/apps/advanced/backend/config/params.php +++ b/apps/advanced/backend/config/params.php @@ -1,4 +1,4 @@ 'admin@example.com', -); +]; diff --git a/apps/advanced/backend/controllers/SiteController.php b/apps/advanced/backend/controllers/SiteController.php index 28f2310..ecf684c 100644 --- a/apps/advanced/backend/controllers/SiteController.php +++ b/apps/advanced/backend/controllers/SiteController.php @@ -10,32 +10,31 @@ class SiteController extends Controller { public function behaviors() { - return array( - 'access' => array( + return [ + 'access' => [ 'class' => \yii\web\AccessControl::className(), - 'rules' => array( - array( - 'actions' => array('login'), + 'rules' => [ + [ + 'actions' => ['login', 'error'], 'allow' => true, - 'roles' => array('?'), - ), - array( - 'actions' => array('logout', 'index'), + ], + [ + 'actions' => ['logout', 'index'], 'allow' => true, - 'roles' => array('@'), - ), - ), - ), - ); + 'roles' => ['@'], + ], + ], + ], + ]; } public function actions() { - return array( - 'error' => array( + return [ + 'error' => [ 'class' => 'yii\web\ErrorAction', - ), - ); + ], + ]; } public function actionIndex() @@ -45,13 +44,17 @@ class SiteController extends Controller public function actionLogin() { + if (!\Yii::$app->user->isGuest) { + $this->goHome(); + } + $model = new LoginForm(); if ($model->load($_POST) && $model->login()) { - return $this->goHome(); + return $this->goBack(); } else { - return $this->render('login', array( + return $this->render('login', [ 'model' => $model, - )); + ]); } } diff --git a/apps/advanced/backend/views/layouts/main.php b/apps/advanced/backend/views/layouts/main.php index 928f990..fdffc26 100644 --- a/apps/advanced/backend/views/layouts/main.php +++ b/apps/advanced/backend/views/layouts/main.php @@ -1,60 +1,60 @@ beginPage(); ?> - +
- -diff --git a/apps/advanced/backend/views/site/index.php b/apps/advanced/backend/views/site/index.php index f2e6d5e..bcb2278 100644 --- a/apps/advanced/backend/views/site/index.php +++ b/apps/advanced/backend/views/site/index.php @@ -1,6 +1,6 @@ title = 'My Yii Application'; ?> diff --git a/apps/advanced/backend/views/site/login.php b/apps/advanced/backend/views/site/login.php index 0c16570..41973e5 100644 --- a/apps/advanced/backend/views/site/login.php +++ b/apps/advanced/backend/views/site/login.php @@ -3,7 +3,7 @@ use yii\helpers\Html; use yii\widgets\ActiveForm; /** - * @var yii\base\View $this + * @var yii\web\View $this * @var yii\widgets\ActiveForm $form * @var app\models\LoginForm $model */ @@ -11,18 +11,18 @@ $this->title = 'Login'; $this->params['breadcrumbs'][] = $this->title; ?>
Please fill out the following fields to login:
This is the About page. You may modify the following file to customize its content:
-
+ = __FILE__ ?>
If you have business inquiries or other questions, please fill out the following form to contact us. Thank you. @@ -20,17 +20,17 @@ $this->params['breadcrumbs'][] = $this->title;
diff --git a/apps/advanced/frontend/views/site/index.php b/apps/advanced/frontend/views/site/index.php index f2e6d5e..bcb2278 100644 --- a/apps/advanced/frontend/views/site/index.php +++ b/apps/advanced/frontend/views/site/index.php @@ -1,6 +1,6 @@ title = 'My Yii Application'; ?> diff --git a/apps/advanced/frontend/views/site/login.php b/apps/advanced/frontend/views/site/login.php index 5e7f6f6..75dd4ca 100644 --- a/apps/advanced/frontend/views/site/login.php +++ b/apps/advanced/frontend/views/site/login.php @@ -3,7 +3,7 @@ use yii\helpers\Html; use yii\widgets\ActiveForm; /** - * @var yii\base\View $this + * @var yii\web\View $this * @var yii\widgets\ActiveForm $form * @var app\models\LoginForm $model */ @@ -11,21 +11,21 @@ $this->title = 'Login'; $this->params['breadcrumbs'][] = $this->title; ?>
Please fill out the following fields to login:
Please fill out your email. A link to reset password will be sent there.
Please choose your new password:
Please fill out the following fields to signup:
true
.' : ''
- ),
- array(
+ ],
+ [
'name' => 'APC extension',
'mandatory' => false,
- 'condition' => extension_loaded('apc') || extension_loaded('apc'),
+ 'condition' => extension_loaded('apc'),
'by' => 'CApcCache',
- ),
+ ],
// Additional PHP extensions :
- array(
+ [
'name' => 'Mcrypt extension',
'mandatory' => false,
'condition' => extension_loaded('mcrypt'),
'by' => 'CSecurityManager',
'memo' => 'Required by encrypt and decrypt methods.'
- ),
+ ],
// PHP ini :
- 'phpSafeMode' => array(
+ 'phpSafeMode' => [
'name' => 'PHP safe mode',
'mandatory' => false,
'condition' => $requirementsChecker->checkPhpIniOff("safe_mode"),
'by' => 'File uploading and console command execution',
'memo' => '"safe_mode" should be disabled at php.ini',
- ),
- 'phpExposePhp' => array(
+ ],
+ 'phpExposePhp' => [
'name' => 'Expose PHP',
'mandatory' => false,
'condition' => $requirementsChecker->checkPhpIniOff("expose_php"),
'by' => 'Security reasons',
'memo' => '"expose_php" should be disabled at php.ini',
- ),
- 'phpAllowUrlInclude' => array(
+ ],
+ 'phpAllowUrlInclude' => [
'name' => 'PHP allow url include',
'mandatory' => false,
'condition' => $requirementsChecker->checkPhpIniOff("allow_url_include"),
'by' => 'Security reasons',
'memo' => '"allow_url_include" should be disabled at php.ini',
- ),
- 'phpSmtp' => array(
+ ],
+ 'phpSmtp' => [
'name' => 'PHP mail SMTP',
'mandatory' => false,
'condition' => strlen(ini_get('SMTP'))>0,
'by' => 'Email sending',
'memo' => 'PHP mail SMTP server required',
- ),
-);
+ ],
+];
$requirementsChecker->checkYii()->check($requirements)->render();
diff --git a/apps/basic/LICENSE.md b/apps/basic/LICENSE.md
index 6edcc4f..e98f03d 100644
--- a/apps/basic/LICENSE.md
+++ b/apps/basic/LICENSE.md
@@ -1,7 +1,7 @@
The Yii framework is free software. It is released under the terms of
the following BSD License.
-Copyright © 2008-2013 by Yii Software LLC (http://www.yiisoft.com)
+Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com)
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -29,4 +29,4 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
+POSSIBILITY OF SUCH DAMAGE.
diff --git a/apps/basic/README.md b/apps/basic/README.md
index aaa7fba..60c3270 100644
--- a/apps/basic/README.md
+++ b/apps/basic/README.md
@@ -31,7 +31,7 @@ DIRECTORY STRUCTURE
REQUIREMENTS
------------
-The minimum requirement by Yii is that your Web server supports PHP 5.3.?.
+The minimum requirement by Yii is that your Web server supports PHP 5.4.0.
In order for captcha to work you need either GD2 extension or ImageMagick PHP extension.
diff --git a/apps/advanced/backend/config/AppAsset.php b/apps/basic/assets/AppAsset.php
similarity index 79%
rename from apps/advanced/backend/config/AppAsset.php
rename to apps/basic/assets/AppAsset.php
index 267e48c..c964d36 100644
--- a/apps/advanced/backend/config/AppAsset.php
+++ b/apps/basic/assets/AppAsset.php
@@ -5,7 +5,7 @@
* @license http://www.yiiframework.com/license/
*/
-namespace backend\config;
+namespace app\assets;
use yii\web\AssetBundle;
@@ -17,13 +17,13 @@ class AppAsset extends AssetBundle
{
public $basePath = '@webroot';
public $baseUrl = '@web';
- public $css = array(
+ public $css = [
'css/site.css',
- );
- public $js = array(
- );
- public $depends = array(
+ ];
+ public $js = [
+ ];
+ public $depends = [
'yii\web\YiiAsset',
'yii\bootstrap\BootstrapAsset',
- );
+ ];
}
diff --git a/apps/basic/codeception.yml b/apps/basic/codeception.yml
index 5b1f441..b6adeb5 100644
--- a/apps/basic/codeception.yml
+++ b/apps/basic/codeception.yml
@@ -6,7 +6,6 @@ paths:
settings:
bootstrap: _bootstrap.php
suite_class: \PHPUnit_Framework_TestSuite
- colors: true
memory_limit: 1024M
log: true
modules:
diff --git a/apps/basic/composer.json b/apps/basic/composer.json
index dd50b69..cef46b7 100644
--- a/apps/basic/composer.json
+++ b/apps/basic/composer.json
@@ -14,21 +14,24 @@
},
"minimum-stability": "dev",
"require": {
- "php": ">=5.3.0",
+ "php": ">=5.4.0",
"yiisoft/yii2": "dev-master",
- "yiisoft/yii2-composer": "dev-master"
+ "yiisoft/yii2-swiftmailer": "dev-master",
+ "yiisoft/yii2-bootstrap": "dev-master",
+ "yiisoft/yii2-debug": "dev-master",
+ "yiisoft/yii2-gii": "dev-master"
},
"scripts": {
"post-create-project-cmd": [
- "yii\\composer\\InstallHandler::setPermissions"
+ "yii\\composer\\Installer::setPermission"
]
},
"extra": {
- "yii-install-writable": [
+ "writable": [
"runtime",
"web/assets"
],
- "yii-install-executable": [
+ "executable": [
"yii"
]
}
diff --git a/apps/basic/config/console.php b/apps/basic/config/console.php
index 12f13cd..6f3f9a8 100644
--- a/apps/basic/config/console.php
+++ b/apps/basic/config/console.php
@@ -1,25 +1,24 @@
'bootstrap-console',
+return [
+ 'id' => 'basic-console',
'basePath' => dirname(__DIR__),
- 'preload' => array('log'),
+ 'preload' => ['log'],
'controllerPath' => dirname(__DIR__) . '/commands',
'controllerNamespace' => 'app\commands',
- 'modules' => array(
- ),
- 'components' => array(
- 'cache' => array(
+ 'extensions' => require(__DIR__ . '/../vendor/yiisoft/extensions.php'),
+ 'components' => [
+ 'cache' => [
'class' => 'yii\caching\FileCache',
- ),
- 'log' => array(
- 'targets' => array(
- array(
+ ],
+ 'log' => [
+ 'targets' => [
+ [
'class' => 'yii\log\FileTarget',
- 'levels' => array('error', 'warning'),
- ),
- ),
- ),
- ),
+ 'levels' => ['error', 'warning'],
+ ],
+ ],
+ ],
+ ],
'params' => $params,
-);
+];
diff --git a/apps/basic/config/params.php b/apps/basic/config/params.php
index 398a1ce..93cb368 100644
--- a/apps/basic/config/params.php
+++ b/apps/basic/config/params.php
@@ -1,5 +1,5 @@
'admin@example.com',
-);
+];
diff --git a/apps/basic/config/web.php b/apps/basic/config/web.php
index e7d9420..cf921b0 100644
--- a/apps/basic/config/web.php
+++ b/apps/basic/config/web.php
@@ -1,33 +1,37 @@
'bootstrap',
+$config = [
+ 'id' => 'basic',
'basePath' => dirname(__DIR__),
- 'components' => array(
- 'request' => array(
+ 'extensions' => require(__DIR__ . '/../vendor/yiisoft/extensions.php'),
+ 'components' => [
+ 'request' => [
'enableCsrfValidation' => true,
- ),
- 'cache' => array(
+ ],
+ 'cache' => [
'class' => 'yii\caching\FileCache',
- ),
- 'user' => array(
+ ],
+ 'user' => [
'identityClass' => 'app\models\User',
- ),
- 'errorHandler' => array(
+ ],
+ 'errorHandler' => [
'errorAction' => 'site/error',
- ),
- 'log' => array(
+ ],
+ 'mail' => [
+ 'class' => 'yii\swiftmailer\Mailer',
+ ],
+ 'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
- 'targets' => array(
- array(
+ 'targets' => [
+ [
'class' => 'yii\log\FileTarget',
- 'levels' => array('error', 'warning'),
- ),
- ),
- ),
- ),
+ 'levels' => ['error', 'warning'],
+ ],
+ ],
+ ],
+ ],
'params' => $params,
-);
+];
if (YII_ENV_DEV) {
$config['preload'][] = 'debug';
diff --git a/apps/basic/controllers/SiteController.php b/apps/basic/controllers/SiteController.php
index 1196280..e3ca29b 100644
--- a/apps/basic/controllers/SiteController.php
+++ b/apps/basic/controllers/SiteController.php
@@ -13,43 +13,38 @@ class SiteController extends Controller
{
public function behaviors()
{
- return array(
- 'access' => array(
+ return [
+ 'access' => [
'class' => AccessControl::className(),
- 'only' => array('login', 'logout'),
- 'rules' => array(
- array(
- 'actions' => array('login'),
+ 'only' => ['logout'],
+ 'rules' => [
+ [
+ 'actions' => ['logout'],
'allow' => true,
- 'roles' => array('?'),
- ),
- array(
- 'actions' => array('logout'),
- 'allow' => true,
- 'roles' => array('@'),
- ),
- ),
- ),
- 'verbs' => array(
+ 'roles' => ['@'],
+ ],
+ ],
+ ],
+ 'verbs' => [
'class' => VerbFilter::className(),
- 'actions' => array(
- 'logout' => array('post'),
- ),
- ),
- );
+ 'actions' => [
+ 'logout' => ['post'],
+ ],
+ ],
+ ];
}
public function actions()
{
- return array(
- 'error' => array(
+ return [
+ 'error' => [
'class' => 'yii\web\ErrorAction',
- ),
- 'captcha' => array(
+ ],
+ 'captcha' => [
'class' => 'yii\captcha\CaptchaAction',
'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null,
- ),
- );
+ ],
+ ];
}
public function actionIndex()
@@ -59,13 +54,17 @@ class SiteController extends Controller
public function actionLogin()
{
+ if (!\Yii::$app->user->isGuest) {
+ $this->goHome();
+ }
+
$model = new LoginForm();
if ($model->load($_POST) && $model->login()) {
- return $this->goHome();
+ return $this->goBack();
} else {
- return $this->render('login', array(
+ return $this->render('login', [
'model' => $model,
- ));
+ ]);
}
}
@@ -82,9 +81,9 @@ class SiteController extends Controller
Yii::$app->session->setFlash('contactFormSubmitted');
return $this->refresh();
} else {
- return $this->render('contact', array(
+ return $this->render('contact', [
'model' => $model,
- ));
+ ]);
}
}
diff --git a/apps/basic/models/ContactForm.php b/apps/basic/models/ContactForm.php
index 7b713a1..1344562 100644
--- a/apps/basic/models/ContactForm.php
+++ b/apps/basic/models/ContactForm.php
@@ -2,6 +2,7 @@
namespace app\models;
+use Yii;
use yii\base\Model;
/**
@@ -20,14 +21,14 @@ class ContactForm extends Model
*/
public function rules()
{
- return array(
+ return [
// name, email, subject and body are required
- array('name, email, subject, body', 'required'),
+ [['name', 'email', 'subject', 'body'], 'required'],
// email has to be a valid email address
- array('email', 'email'),
+ ['email', 'email'],
// verifyCode needs to be entered correctly
- array('verifyCode', 'captcha'),
- );
+ ['verifyCode', 'captcha'],
+ ];
}
/**
@@ -35,9 +36,9 @@ class ContactForm extends Model
*/
public function attributeLabels()
{
- return array(
+ return [
'verifyCode' => 'Verification Code',
- );
+ ];
}
/**
@@ -48,13 +49,12 @@ class ContactForm extends Model
public function contact($email)
{
if ($this->validate()) {
- $name = '=?UTF-8?B?' . base64_encode($this->name) . '?=';
- $subject = '=?UTF-8?B?' . base64_encode($this->subject) . '?=';
- $headers = "From: $name <{$this->email}>\r\n" .
- "Reply-To: {$this->email}\r\n" .
- "MIME-Version: 1.0\r\n" .
- "Content-type: text/plain; charset=UTF-8";
- mail($email, $subject, $this->body, $headers);
+ Yii::$app->mail->compose()
+ ->setTo($email)
+ ->setFrom([$this->email => $this->name])
+ ->setSubject($this->subject)
+ ->setTextBody($this->body)
+ ->send();
return true;
} else {
return false;
diff --git a/apps/basic/models/LoginForm.php b/apps/basic/models/LoginForm.php
index 5ba1dc6..a365db7 100644
--- a/apps/basic/models/LoginForm.php
+++ b/apps/basic/models/LoginForm.php
@@ -14,19 +14,21 @@ class LoginForm extends Model
public $password;
public $rememberMe = true;
+ private $_user = false;
+
/**
* @return array the validation rules.
*/
public function rules()
{
- return array(
+ return [
// username and password are both required
- array('username, password', 'required'),
+ [['username', 'password'], 'required'],
// password is validated by validatePassword()
- array('password', 'validatePassword'),
+ ['password', 'validatePassword'],
// rememberMe must be a boolean value
- array('rememberMe', 'boolean'),
- );
+ ['rememberMe', 'boolean'],
+ ];
}
/**
@@ -35,7 +37,7 @@ class LoginForm extends Model
*/
public function validatePassword()
{
- $user = User::findByUsername($this->username);
+ $user = $this->getUser();
if (!$user || !$user->validatePassword($this->password)) {
$this->addError('password', 'Incorrect username or password.');
}
@@ -48,11 +50,22 @@ class LoginForm extends Model
public function login()
{
if ($this->validate()) {
- $user = User::findByUsername($this->username);
- Yii::$app->user->login($user, $this->rememberMe ? 3600*24*30 : 0);
- return true;
+ return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600*24*30 : 0);
} else {
return false;
}
}
+
+ /**
+ * Finds user by [[username]]
+ *
+ * @return User|null
+ */
+ private function getUser()
+ {
+ if ($this->_user === false) {
+ $this->_user = User::findByUsername($this->username);
+ }
+ return $this->_user;
+ }
}
diff --git a/apps/basic/models/User.php b/apps/basic/models/User.php
index e1088a0..af4c42e 100644
--- a/apps/basic/models/User.php
+++ b/apps/basic/models/User.php
@@ -9,31 +9,31 @@ class User extends \yii\base\Object implements \yii\web\IdentityInterface
public $password;
public $authKey;
- private static $users = array(
- '100' => array(
+ private static $users = [
+ '100' => [
'id' => '100',
'username' => 'admin',
'password' => 'admin',
'authKey' => 'test100key',
- ),
- '101' => array(
+ ],
+ '101' => [
'id' => '101',
'username' => 'demo',
'password' => 'demo',
'authKey' => 'test101key',
- ),
- );
+ ],
+ ];
public static function findIdentity($id)
{
- return isset(self::$users[$id]) ? new self(self::$users[$id]) : null;
+ return isset(self::$users[$id]) ? new static(self::$users[$id]) : null;
}
public static function findByUsername($username)
{
foreach (self::$users as $user) {
if (strcasecmp($user['username'], $username) === 0) {
- return new self($user);
+ return new static($user);
}
}
return null;
diff --git a/apps/basic/requirements.php b/apps/basic/requirements.php
index c9e6493..47bdf37 100644
--- a/apps/basic/requirements.php
+++ b/apps/basic/requirements.php
@@ -26,78 +26,78 @@ $requirementsChecker = new YiiRequirementChecker();
/**
* Adjust requirements according to your application specifics.
*/
-$requirements = array(
+$requirements = [
// Database :
- array(
+ [
'name' => 'PDO extension',
'mandatory' => true,
'condition' => extension_loaded('pdo'),
'by' => 'All DB-related classes',
- ),
- array(
+ ],
+ [
'name' => 'PDO SQLite extension',
'mandatory' => false,
'condition' => extension_loaded('pdo_sqlite'),
'by' => 'All DB-related classes',
'memo' => 'Required for SQLite database.',
- ),
- array(
+ ],
+ [
'name' => 'PDO MySQL extension',
'mandatory' => false,
'condition' => extension_loaded('pdo_mysql'),
'by' => 'All DB-related classes',
'memo' => 'Required for MySQL database.',
- ),
+ ],
// Cache :
- array(
+ [
'name' => 'Memcache extension',
'mandatory' => false,
'condition' => extension_loaded('memcache') || extension_loaded('memcached'),
'by' => 'CMemCache',
'memo' => extension_loaded('memcached') ? 'To use memcached set CMemCache::useMemcached to true
.' : ''
- ),
- array(
+ ],
+ [
'name' => 'APC extension',
'mandatory' => false,
- 'condition' => extension_loaded('apc') || extension_loaded('apc'),
+ 'condition' => extension_loaded('apc'),
'by' => 'CApcCache',
- ),
+ ],
// Additional PHP extensions :
- array(
+ [
'name' => 'Mcrypt extension',
'mandatory' => false,
'condition' => extension_loaded('mcrypt'),
'by' => 'CSecurityManager',
'memo' => 'Required by encrypt and decrypt methods.'
- ),
+ ],
// PHP ini :
- 'phpSafeMode' => array(
+ 'phpSafeMode' => [
'name' => 'PHP safe mode',
'mandatory' => false,
'condition' => $requirementsChecker->checkPhpIniOff("safe_mode"),
'by' => 'File uploading and console command execution',
'memo' => '"safe_mode" should be disabled at php.ini',
- ),
- 'phpExposePhp' => array(
+ ],
+ 'phpExposePhp' => [
'name' => 'Expose PHP',
'mandatory' => false,
'condition' => $requirementsChecker->checkPhpIniOff("expose_php"),
'by' => 'Security reasons',
'memo' => '"expose_php" should be disabled at php.ini',
- ),
- 'phpAllowUrlInclude' => array(
+ ],
+ 'phpAllowUrlInclude' => [
'name' => 'PHP allow url include',
'mandatory' => false,
'condition' => $requirementsChecker->checkPhpIniOff("allow_url_include"),
'by' => 'Security reasons',
'memo' => '"allow_url_include" should be disabled at php.ini',
- ),
- 'phpSmtp' => array(
+ ],
+ 'phpSmtp' => [
'name' => 'PHP mail SMTP',
'mandatory' => false,
'condition' => strlen(ini_get('SMTP'))>0,
'by' => 'Email sending',
'memo' => 'PHP mail SMTP server required',
- ),
-);
+ ],
+];
$requirementsChecker->checkYii()->check($requirements)->render();
diff --git a/apps/basic/tests/README.md b/apps/basic/tests/README.md
new file mode 100644
index 0000000..c87f762
--- /dev/null
+++ b/apps/basic/tests/README.md
@@ -0,0 +1,20 @@
+This folder contains various tests for the basic application.
+These tests are developed with [Codeception PHP Testing Framework](http://codeception.com/).
+
+To run the tests, follow these steps:
+
+1. [Install Codeception](http://codeception.com/quickstart) if you do not have it yet.
+2. Create test configuration files based on your environment:
+ - Copy `acceptance.suite.dist.yml` to `acceptance.suite.yml` and customize it;
+ - Copy `functional.suite.dist.yml` to `functional.suite.yml` and customize it;
+ - Copy `unit.suite.dist.yml` to `unit.suite.yml` and customize it.
+3. Switch to the parent folder and run tests:
+
+```
+cd ..
+php codecept.phar build // rebuild test scripts, only need to be run once
+php codecept.phar run // run all available tests
+```
+
+Please refer to [Codeception tutorial](http://codeception.com/docs/01-Introduction) for
+more details about writing acceptance, functional and unit tests.
diff --git a/apps/basic/tests/acceptance/ContactCept.php b/apps/basic/tests/acceptance/ContactCept.php
index 73527ab..5ec5641 100644
--- a/apps/basic/tests/acceptance/ContactCept.php
+++ b/apps/basic/tests/acceptance/ContactCept.php
@@ -4,7 +4,7 @@ $I->wantTo('ensure that contact works');
$I->amOnPage('?r=site/contact');
$I->see('Contact', 'h1');
-$I->submitForm('#contact-form', array());
+$I->submitForm('#contact-form', []);
$I->see('Contact', 'h1');
$I->see('Name cannot be blank');
$I->see('Email cannot be blank');
@@ -12,25 +12,25 @@ $I->see('Subject cannot be blank');
$I->see('Body cannot be blank');
$I->see('The verification code is incorrect');
-$I->submitForm('#contact-form', array(
+$I->submitForm('#contact-form', [
'ContactForm[name]' => 'tester',
'ContactForm[email]' => 'tester.email',
'ContactForm[subject]' => 'test subject',
'ContactForm[body]' => 'test content',
'ContactForm[verifyCode]' => 'testme',
-));
+]);
$I->dontSee('Name cannot be blank', '.help-inline');
$I->see('Email is not a valid email address.');
$I->dontSee('Subject cannot be blank', '.help-inline');
$I->dontSee('Body cannot be blank', '.help-inline');
$I->dontSee('The verification code is incorrect', '.help-inline');
-$I->submitForm('#contact-form', array(
+$I->submitForm('#contact-form', [
'ContactForm[name]' => 'tester',
'ContactForm[email]' => 'tester@example.com',
'ContactForm[subject]' => 'test subject',
'ContactForm[body]' => 'test content',
'ContactForm[verifyCode]' => 'testme',
-));
+]);
$I->dontSeeElement('#contact-form');
$I->see('Thank you for contacting us. We will respond to you as soon as possible.');
diff --git a/apps/basic/tests/acceptance/LoginCept.php b/apps/basic/tests/acceptance/LoginCept.php
index 77c4a07..5621b15 100644
--- a/apps/basic/tests/acceptance/LoginCept.php
+++ b/apps/basic/tests/acceptance/LoginCept.php
@@ -4,20 +4,20 @@ $I->wantTo('ensure that login works');
$I->amOnPage('?r=site/login');
$I->see('Login', 'h1');
-$I->submitForm('#login-form', array());
+$I->submitForm('#login-form', []);
$I->dontSee('Logout (admin)');
$I->see('Username cannot be blank');
$I->see('Password cannot be blank');
-$I->submitForm('#login-form', array(
+$I->submitForm('#login-form', [
'LoginForm[username]' => 'admin',
'LoginForm[password]' => 'wrong',
-));
+]);
$I->dontSee('Logout (admin)');
$I->see('Incorrect username or password');
-$I->submitForm('#login-form', array(
+$I->submitForm('#login-form', [
'LoginForm[username]' => 'admin',
'LoginForm[password]' => 'admin',
-));
+]);
$I->see('Logout (admin)');
diff --git a/apps/basic/tests/acceptance/WebGuy.php b/apps/basic/tests/acceptance/WebGuy.php
index 397761c..f08ed9c 100644
--- a/apps/basic/tests/acceptance/WebGuy.php
+++ b/apps/basic/tests/acceptance/WebGuy.php
@@ -17,13 +17,21 @@ use Codeception\Module\WebHelper;
* @method void expect($prediction)
* @method void amGoingTo($argumentation)
* @method void am($role)
- * @method void lookForwardTo($role)
+ * @method void lookForwardTo($achieveValue)
+ * @method void offsetGet($offset)
+ * @method void offsetSet($offset, $value)
+ * @method void offsetExists($offset)
+ * @method void offsetUnset($offset)
*/
class WebGuy extends \Codeception\AbstractGuy
{
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Submits a form located on page.
* Specify the form by it's css or xpath selector.
* Fill the form fields values as array.
@@ -62,13 +70,11 @@ class WebGuy extends \Codeception\AbstractGuy
*
* @param $selector
* @param $params
- * @see PhpBrowser::submitForm()
+ * @see Codeception\Module\PhpBrowser::submitForm()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function submitForm($selector, $params) {
- $this->scenario->action('submitForm', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Action('submitForm', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -78,6 +84,10 @@ class WebGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* If your page triggers an ajax request, you can perform it manually.
* This action sends a POST ajax request with specified params.
* Additional params can be passed as array.
@@ -96,13 +106,11 @@ class WebGuy extends \Codeception\AbstractGuy
*
* @param $uri
* @param $params
- * @see PhpBrowser::sendAjaxPostRequest()
+ * @see Codeception\Module\PhpBrowser::sendAjaxPostRequest()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function sendAjaxPostRequest($uri, $params = null) {
- $this->scenario->action('sendAjaxPostRequest', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Action('sendAjaxPostRequest', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -112,6 +120,10 @@ class WebGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* If your page triggers an ajax request, you can perform it manually.
* This action sends a GET ajax request with specified params.
*
@@ -119,13 +131,11 @@ class WebGuy extends \Codeception\AbstractGuy
*
* @param $uri
* @param $params
- * @see PhpBrowser::sendAjaxGetRequest()
+ * @see Codeception\Module\PhpBrowser::sendAjaxGetRequest()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function sendAjaxGetRequest($uri, $params = null) {
- $this->scenario->action('sendAjaxGetRequest', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Action('sendAjaxGetRequest', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -135,14 +145,34 @@ class WebGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Asserts that current page has 404 response status code.
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Module\PhpBrowser::seePageNotFound()
+ * @return \Codeception\Maybe
+ */
+ public function canSeePageNotFound() {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seePageNotFound', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Asserts that current page has 404 response status code.
- * @see PhpBrowser::seePageNotFound()
+ * @see Codeception\Module\PhpBrowser::seePageNotFound()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function seePageNotFound() {
- $this->scenario->assertion('seePageNotFound', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Assertion('seePageNotFound', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -152,17 +182,40 @@ class WebGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that response code is equal to value provided.
+ *
+ * @param $code
+ * @return mixed
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Module\PhpBrowser::seeResponseCodeIs()
+ * @return \Codeception\Maybe
+ */
+ public function canSeeResponseCodeIs($code) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIs', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Checks that response code is equal to value provided.
*
* @param $code
* @return mixed
- * @see PhpBrowser::seeResponseCodeIs()
+ * @see Codeception\Module\PhpBrowser::seeResponseCodeIs()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function seeResponseCodeIs($code) {
- $this->scenario->assertion('seeResponseCodeIs', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Assertion('seeResponseCodeIs', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -172,17 +225,19 @@ class WebGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Adds HTTP authentication via username/password.
*
* @param $username
* @param $password
- * @see PhpBrowser::amHttpAuthenticated()
+ * @see Codeception\Module\PhpBrowser::amHttpAuthenticated()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function amHttpAuthenticated($username, $password) {
- $this->scenario->condition('amHttpAuthenticated', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Condition('amHttpAuthenticated', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -192,6 +247,10 @@ class WebGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Low-level API method.
* If Codeception commands are not enough, use [Guzzle HTTP Client](http://guzzlephp.org/) methods directly
*
@@ -216,13 +275,135 @@ class WebGuy extends \Codeception\AbstractGuy
* If Codeception lacks important Guzzle Client methods implement then and submit patches.
*
* @param callable $function
- * @see PhpBrowser::executeInGuzzle()
+ * @see Codeception\Module\PhpBrowser::executeInGuzzle()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function executeInGuzzle($function) {
- $this->scenario->action('executeInGuzzle', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Action('executeInGuzzle', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+
+
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Assert if the specified checkbox is checked.
+ * Use css selector or xpath to match.
+ *
+ * Example:
+ *
+ * ``` php
+ * seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms
+ * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form.
+ * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]');
+ * ?>
+ * ```
+ *
+ * @param $checkbox
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Module\PhpBrowser::seeCheckboxIsChecked()
+ * @return \Codeception\Maybe
+ */
+ public function canSeeCheckboxIsChecked($checkbox) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeCheckboxIsChecked', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Assert if the specified checkbox is checked.
+ * Use css selector or xpath to match.
+ *
+ * Example:
+ *
+ * ``` php
+ * seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms
+ * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form.
+ * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]');
+ * ?>
+ * ```
+ *
+ * @param $checkbox
+ * @see Codeception\Module\PhpBrowser::seeCheckboxIsChecked()
+ * @return \Codeception\Maybe
+ */
+ public function seeCheckboxIsChecked($checkbox) {
+ $this->scenario->addStep(new \Codeception\Step\Assertion('seeCheckboxIsChecked', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+
+
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Assert if the specified checkbox is unchecked.
+ * Use css selector or xpath to match.
+ *
+ * Example:
+ *
+ * ``` php
+ * dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms
+ * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form.
+ * ?>
+ * ```
+ *
+ * @param $checkbox
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Module\PhpBrowser::dontSeeCheckboxIsChecked()
+ * @return \Codeception\Maybe
+ */
+ public function cantSeeCheckboxIsChecked($checkbox) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeCheckboxIsChecked', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Assert if the specified checkbox is unchecked.
+ * Use css selector or xpath to match.
+ *
+ * Example:
+ *
+ * ``` php
+ * dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms
+ * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form.
+ * ?>
+ * ```
+ *
+ * @param $checkbox
+ * @see Codeception\Module\PhpBrowser::dontSeeCheckboxIsChecked()
+ * @return \Codeception\Maybe
+ */
+ public function dontSeeCheckboxIsChecked($checkbox) {
+ $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeCheckboxIsChecked', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -232,16 +413,18 @@ class WebGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Opens the page.
*
* @param $page
- * @see Mink::amOnPage()
+ * @see Codeception\Util\Mink::amOnPage()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function amOnPage($page) {
- $this->scenario->condition('amOnPage', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Condition('amOnPage', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -251,6 +434,10 @@ class WebGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Sets 'url' configuration parameter to hosts subdomain.
* It does not open a page on subdomain. Use `amOnPage` for that
*
@@ -267,13 +454,54 @@ class WebGuy extends \Codeception\AbstractGuy
* ```
* @param $subdomain
* @return mixed
- * @see Mink::amOnSubdomain()
+ * @see Codeception\Util\Mink::amOnSubdomain()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function amOnSubdomain($subdomain) {
- $this->scenario->condition('amOnSubdomain', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Condition('amOnSubdomain', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+
+
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * @param string $text
+ * @param string $selector
+ *
+ * @return void
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Mink::dontSee()
+ * @return \Codeception\Maybe
+ */
+ public function cantSee($text, $selector = null) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSee', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * @param string $text
+ * @param string $selector
+ *
+ * @return void
+ * @see Codeception\Util\Mink::dontSee()
+ * @return \Codeception\Maybe
+ */
+ public function dontSee($text, $selector = null) {
+ $this->scenario->addStep(new \Codeception\Step\Assertion('dontSee', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -283,36 +511,42 @@ class WebGuy extends \Codeception\AbstractGuy
/**
- * Check if current page doesn't contain the text specified.
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Check if current page contains the text specified.
* Specify the css selector to match only specific region.
*
* Examples:
*
- * ```php
+ * ``` php
* dontSee('Login'); // I can suppose user is already logged in
- * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page
- * $I->dontSee('Sign Up','//body/h1'); // with XPath
+ * $I->see('Logout'); // I can suppose user is logged in
+ * $I->see('Sign Up','h1'); // I can suppose it's a signup page
+ * $I->see('Sign Up','//body/h1'); // with XPath
+ * ?>
* ```
*
* @param $text
* @param null $selector
- * @see Mink::dontSee()
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Mink::see()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
- public function dontSee($text, $selector = null) {
- $this->scenario->action('dontSee', func_get_args());
+ public function canSee($text, $selector = null) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('see', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
-
-
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Check if current page contains the text specified.
* Specify the css selector to match only specific region.
*
@@ -323,18 +557,16 @@ class WebGuy extends \Codeception\AbstractGuy
* $I->see('Logout'); // I can suppose user is logged in
* $I->see('Sign Up','h1'); // I can suppose it's a signup page
* $I->see('Sign Up','//body/h1'); // with XPath
- *
+ * ?>
* ```
*
* @param $text
* @param null $selector
- * @see Mink::see()
+ * @see Codeception\Util\Mink::see()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function see($text, $selector = null) {
- $this->scenario->assertion('see', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Assertion('see', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -344,6 +576,10 @@ class WebGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Checks if there is a link with text specified.
* Specify url to match link with exact this url.
*
@@ -353,18 +589,47 @@ class WebGuy extends \Codeception\AbstractGuy
* seeLink('Logout'); // matches Logout
* $I->seeLink('Logout','/logout'); // matches Logout
+ * ?>
+ * ```
*
+ * @param $text
+ * @param null $url
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Mink::seeLink()
+ * @return \Codeception\Maybe
+ */
+ public function canSeeLink($text, $url = null) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeLink', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks if there is a link with text specified.
+ * Specify url to match link with exact this url.
+ *
+ * Examples:
+ *
+ * ``` php
+ * seeLink('Logout'); // matches Logout
+ * $I->seeLink('Logout','/logout'); // matches Logout
+ * ?>
* ```
*
* @param $text
* @param null $url
- * @see Mink::seeLink()
+ * @see Codeception\Util\Mink::seeLink()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function seeLink($text, $url = null) {
- $this->scenario->assertion('seeLink', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Assertion('seeLink', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -374,6 +639,10 @@ class WebGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Checks if page doesn't contain the link with text specified.
* Specify url to narrow the results.
*
@@ -382,18 +651,46 @@ class WebGuy extends \Codeception\AbstractGuy
* ``` php
* dontSeeLink('Logout'); // I suppose user is not logged in
+ * ?>
+ * ```
*
+ * @param $text
+ * @param null $url
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Mink::dontSeeLink()
+ * @return \Codeception\Maybe
+ */
+ public function cantSeeLink($text, $url = null) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeLink', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks if page doesn't contain the link with text specified.
+ * Specify url to narrow the results.
+ *
+ * Examples:
+ *
+ * ``` php
+ * dontSeeLink('Logout'); // I suppose user is not logged in
+ * ?>
* ```
*
* @param $text
* @param null $url
- * @see Mink::dontSeeLink()
+ * @see Codeception\Util\Mink::dontSeeLink()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function dontSeeLink($text, $url = null) {
- $this->scenario->action('dontSeeLink', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeLink', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -403,6 +700,10 @@ class WebGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Perform a click on link or button.
* Link or button are found by their names or CSS selector.
* Submits a form if button is a submit type.
@@ -431,13 +732,11 @@ class WebGuy extends \Codeception\AbstractGuy
* ```
* @param $link
* @param $context
- * @see Mink::click()
+ * @see Codeception\Util\Mink::click()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function click($link, $context = null) {
- $this->scenario->action('click', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Action('click', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -447,22 +746,50 @@ class WebGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks if element exists on a page, matching it by CSS or XPath
+ *
+ * ``` php
+ * seeElement('.error');
+ * $I->seeElement('//form/input[1]');
+ * ?>
+ * ```
+ * @param $selector
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Mink::seeElement()
+ * @return \Codeception\Maybe
+ */
+ public function canSeeElement($selector) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeElement', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Checks if element exists on a page, matching it by CSS or XPath
*
* ``` php
* seeElement('.error');
- * $I->seeElement(//form/input[1]);
+ * $I->seeElement('//form/input[1]');
* ?>
* ```
* @param $selector
- * @see Mink::seeElement()
+ * @see Codeception\Util\Mink::seeElement()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function seeElement($selector) {
- $this->scenario->assertion('seeElement', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Assertion('seeElement', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -472,22 +799,54 @@ class WebGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks if element does not exist (or is visible) on a page, matching it by CSS or XPath
+ *
+ * Example:
+ *
+ * ``` php
+ * dontSeeElement('.error');
+ * $I->dontSeeElement('//form/input[1]');
+ * ?>
+ * ```
+ * @param $selector
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Mink::dontSeeElement()
+ * @return \Codeception\Maybe
+ */
+ public function cantSeeElement($selector) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeElement', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Checks if element does not exist (or is visible) on a page, matching it by CSS or XPath
*
+ * Example:
+ *
* ``` php
* dontSeeElement('.error');
- * $I->dontSeeElement(//form/input[1]);
+ * $I->dontSeeElement('//form/input[1]');
* ?>
* ```
* @param $selector
- * @see Mink::dontSeeElement()
+ * @see Codeception\Util\Mink::dontSeeElement()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function dontSeeElement($selector) {
- $this->scenario->action('dontSeeElement', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeElement', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -497,14 +856,16 @@ class WebGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Reloads current page
- * @see Mink::reloadPage()
+ * @see Codeception\Util\Mink::reloadPage()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function reloadPage() {
- $this->scenario->action('reloadPage', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Action('reloadPage', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -514,14 +875,16 @@ class WebGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Moves back in history
- * @see Mink::moveBack()
+ * @see Codeception\Util\Mink::moveBack()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function moveBack() {
- $this->scenario->action('moveBack', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Action('moveBack', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -531,14 +894,16 @@ class WebGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Moves forward in history
- * @see Mink::moveForward()
+ * @see Codeception\Util\Mink::moveForward()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function moveForward() {
- $this->scenario->action('moveForward', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Action('moveForward', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -548,17 +913,27 @@ class WebGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Fills a text field or textarea with value.
+ *
+ * Example:
+ *
+ * ``` php
+ * fillField("//input[@type='text']", "Hello World!");
+ * ?>
+ * ```
*
* @param $field
* @param $value
- * @see Mink::fillField()
+ * @see Codeception\Util\Mink::fillField()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function fillField($field, $value) {
- $this->scenario->action('fillField', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Action('fillField', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -568,27 +943,265 @@ class WebGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Selects an option in select tag or in radio button group.
*
* Example:
*
* ``` php
* selectOption('form select[name=account]', 'Premium');
- * $I->selectOption('form input[name=payment]', 'Monthly');
- * $I->selectOption('//form/select[@name=account]', 'Monthly');
+ * $I->selectOption('form select[name=account]', 'Premium');
+ * $I->selectOption('form input[name=payment]', 'Monthly');
+ * $I->selectOption('//form/select[@name=account]', 'Monthly');
+ * ?>
+ * ```
+ *
+ * Can select multiple options if second argument is array:
+ *
+ * ``` php
+ * selectOption('Which OS do you use?', array('Windows','Linux'));
+ * ?>
+ * ```
+ *
+ * @param $select
+ * @param $option
+ * @see Codeception\Util\Mink::selectOption()
+ * @return \Codeception\Maybe
+ */
+ public function selectOption($select, $option) {
+ $this->scenario->addStep(new \Codeception\Step\Action('selectOption', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+
+
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Ticks a checkbox.
+ * For radio buttons use `selectOption` method.
+ *
+ * Example:
+ *
+ * ``` php
+ * checkOption('#agree');
+ * ?>
+ * ```
+ *
+ * @param $option
+ * @see Codeception\Util\Mink::checkOption()
+ * @return \Codeception\Maybe
+ */
+ public function checkOption($option) {
+ $this->scenario->addStep(new \Codeception\Step\Action('checkOption', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+
+
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Unticks a checkbox.
+ *
+ * Example:
+ *
+ * ``` php
+ * uncheckOption('#notify');
+ * ?>
+ * ```
+ *
+ * @param $option
+ * @see Codeception\Util\Mink::uncheckOption()
+ * @return \Codeception\Maybe
+ */
+ public function uncheckOption($option) {
+ $this->scenario->addStep(new \Codeception\Step\Action('uncheckOption', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+
+
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that current uri contains a value
+ *
+ * ``` php
+ * seeInCurrentUrl('home');
+ * // to match: /users/1
+ * $I->seeInCurrentUrl('/users/');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Mink::seeInCurrentUrl()
+ * @return \Codeception\Maybe
+ */
+ public function canSeeInCurrentUrl($uri) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeInCurrentUrl', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that current uri contains a value
+ *
+ * ``` php
+ * seeInCurrentUrl('home');
+ * // to match: /users/1
+ * $I->seeInCurrentUrl('/users/');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * @see Codeception\Util\Mink::seeInCurrentUrl()
+ * @return \Codeception\Maybe
+ */
+ public function seeInCurrentUrl($uri) {
+ $this->scenario->addStep(new \Codeception\Step\Assertion('seeInCurrentUrl', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+
+
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that current uri does not contain a value
+ *
+ * ``` php
+ * dontSeeInCurrentUrl('/users/');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Mink::dontSeeInCurrentUrl()
+ * @return \Codeception\Maybe
+ */
+ public function cantSeeInCurrentUrl($uri) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeInCurrentUrl', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that current uri does not contain a value
+ *
+ * ``` php
+ * dontSeeInCurrentUrl('/users/');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * @see Codeception\Util\Mink::dontSeeInCurrentUrl()
+ * @return \Codeception\Maybe
+ */
+ public function dontSeeInCurrentUrl($uri) {
+ $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeInCurrentUrl', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+
+
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that current url is equal to value.
+ * Unlike `seeInCurrentUrl` performs a strict check.
+ *
+ * ``` php
+ * seeCurrentUrlEquals('/');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Mink::seeCurrentUrlEquals()
+ * @return \Codeception\Maybe
+ */
+ public function canSeeCurrentUrlEquals($uri) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlEquals', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that current url is equal to value.
+ * Unlike `seeInCurrentUrl` performs a strict check.
+ *
+ * ``` php
+ * seeCurrentUrlEquals('/');
* ?>
* ```
*
- * @param $select
- * @param $option
- * @see Mink::selectOption()
+ * @param $uri
+ * @see Codeception\Util\Mink::seeCurrentUrlEquals()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
- public function selectOption($select, $option) {
- $this->scenario->action('selectOption', func_get_args());
+ public function seeCurrentUrlEquals($uri) {
+ $this->scenario->addStep(new \Codeception\Step\Assertion('seeCurrentUrlEquals', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -598,52 +1211,54 @@ class WebGuy extends \Codeception\AbstractGuy
/**
- * Ticks a checkbox.
- * For radio buttons use `selectOption` method.
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
*
- * Example:
+ * Checks that current url is not equal to value.
+ * Unlike `dontSeeInCurrentUrl` performs a strict check.
*
* ``` php
* checkOption('#agree');
+ * // current url is not root
+ * $I->dontSeeCurrentUrlEquals('/');
* ?>
* ```
*
- * @param $option
- * @see Mink::checkOption()
+ * @param $uri
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Mink::dontSeeCurrentUrlEquals()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
- public function checkOption($option) {
- $this->scenario->action('checkOption', func_get_args());
+ public function cantSeeCurrentUrlEquals($uri) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlEquals', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
-
-
/**
- * Unticks a checkbox.
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
*
- * Example:
+ * Checks that current url is not equal to value.
+ * Unlike `dontSeeInCurrentUrl` performs a strict check.
*
* ``` php
* uncheckOption('#notify');
+ * // current url is not root
+ * $I->dontSeeCurrentUrlEquals('/');
* ?>
* ```
*
- * @param $option
- * @see Mink::uncheckOption()
+ * @param $uri
+ * @see Codeception\Util\Mink::dontSeeCurrentUrlEquals()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
- public function uncheckOption($option) {
- $this->scenario->action('uncheckOption', func_get_args());
+ public function dontSeeCurrentUrlEquals($uri) {
+ $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlEquals', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -653,50 +1268,52 @@ class WebGuy extends \Codeception\AbstractGuy
/**
- * Checks that current uri contains a value
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that current url is matches a RegEx value
*
* ``` php
* seeInCurrentUrl('home');
- * // to match: /users/1
- * $I->seeInCurrentUrl('/users/');
+ * // to match root url
+ * $I->seeCurrentUrlMatches('~$/users/(\d+)~');
* ?>
* ```
*
* @param $uri
- * @see Mink::seeInCurrentUrl()
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Mink::seeCurrentUrlMatches()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
- public function seeInCurrentUrl($uri) {
- $this->scenario->assertion('seeInCurrentUrl', func_get_args());
+ public function canSeeCurrentUrlMatches($uri) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlMatches', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
-
-
/**
- * Checks that current uri does not contain a value
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that current url is matches a RegEx value
*
* ``` php
* dontSeeInCurrentUrl('/users/');
+ * // to match root url
+ * $I->seeCurrentUrlMatches('~$/users/(\d+)~');
* ?>
* ```
*
* @param $uri
- * @see Mink::dontSeeInCurrentUrl()
+ * @see Codeception\Util\Mink::seeCurrentUrlMatches()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
- public function dontSeeInCurrentUrl($uri) {
- $this->scenario->action('dontSeeInCurrentUrl', func_get_args());
+ public function seeCurrentUrlMatches($uri) {
+ $this->scenario->addStep(new \Codeception\Step\Assertion('seeCurrentUrlMatches', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -706,47 +1323,52 @@ class WebGuy extends \Codeception\AbstractGuy
/**
- * Checks that current url is equal to value.
- * Unlike `seeInCurrentUrl` performs a strict check.
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that current url does not match a RegEx value
*
+ * ``` php
* seeCurrentUrlEquals('/');
+ * $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~');
* ?>
+ * ```
*
* @param $uri
- * @see Mink::seeCurrentUrlEquals()
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Mink::dontSeeCurrentUrlMatches()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
- public function seeCurrentUrlEquals($uri) {
- $this->scenario->assertion('seeCurrentUrlEquals', func_get_args());
+ public function cantSeeCurrentUrlMatches($uri) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlMatches', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
-
-
/**
- * Checks that current url is not equal to value.
- * Unlike `dontSeeInCurrentUrl` performs a strict check.
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that current url does not match a RegEx value
*
+ * ``` php
* dontSeeCurrentUrlEquals('/');
+ * // to match root url
+ * $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~');
* ?>
+ * ```
*
* @param $uri
- * @see Mink::dontSeeCurrentUrlEquals()
+ * @see Codeception\Util\Mink::dontSeeCurrentUrlMatches()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
- public function dontSeeCurrentUrlEquals($uri) {
- $this->scenario->action('dontSeeCurrentUrlEquals', func_get_args());
+ public function dontSeeCurrentUrlMatches($uri) {
+ $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlMatches', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -756,45 +1378,40 @@ class WebGuy extends \Codeception\AbstractGuy
/**
- * Checks that current url is matches a RegEx value
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
*
- * seeCurrentUrlMatches('~$/users/(\d+)~');
- * ?>
+ * Checks that cookie is set.
*
- * @param $uri
- * @see Mink::seeCurrentUrlMatches()
+ * @param $cookie
+ * @return mixed
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Mink::seeCookie()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
- public function seeCurrentUrlMatches($uri) {
- $this->scenario->assertion('seeCurrentUrlMatches', func_get_args());
+ public function canSeeCookie($cookie) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeCookie', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
-
-
/**
- * Checks that current url does not match a RegEx value
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
*
- * dontSeeCurrentUrlMatches('~$/users/(\d+)~');
- * ?>
+ * Checks that cookie is set.
*
- * @param $uri
- * @see Mink::dontSeeCurrentUrlMatches()
+ * @param $cookie
+ * @return mixed
+ * @see Codeception\Util\Mink::seeCookie()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
- public function dontSeeCurrentUrlMatches($uri) {
- $this->scenario->action('dontSeeCurrentUrlMatches', func_get_args());
+ public function seeCookie($cookie) {
+ $this->scenario->addStep(new \Codeception\Step\Assertion('seeCookie', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -804,31 +1421,40 @@ class WebGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
*
- * @see Mink::seeCookie()
+ * Checks that cookie doesn't exist
+ *
+ * @param $cookie
+ * @return mixed
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Mink::dontSeeCookie()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
- public function seeCookie($cookie) {
- $this->scenario->assertion('seeCookie', func_get_args());
+ public function cantSeeCookie($cookie) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeCookie', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
-
-
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that cookie doesn't exist
*
- * @see Mink::dontSeeCookie()
+ * @param $cookie
+ * @return mixed
+ * @see Codeception\Util\Mink::dontSeeCookie()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function dontSeeCookie($cookie) {
- $this->scenario->action('dontSeeCookie', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeCookie', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -838,14 +1464,20 @@ class WebGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Sets a cookie.
*
- * @see Mink::setCookie()
+ * @param $cookie
+ * @param $value
+ * @return mixed
+ * @see Codeception\Util\Mink::setCookie()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function setCookie($cookie, $value) {
- $this->scenario->action('setCookie', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Action('setCookie', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -855,14 +1487,19 @@ class WebGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
*
- * @see Mink::resetCookie()
+ * Unsets cookie
+ *
+ * @param $cookie
+ * @return mixed
+ * @see Codeception\Util\Mink::resetCookie()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function resetCookie($cookie) {
- $this->scenario->action('resetCookie', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Action('resetCookie', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -872,14 +1509,19 @@ class WebGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
*
- * @see Mink::grabCookie()
+ * Grabs a cookie value.
+ *
+ * @param $cookie
+ * @return mixed
+ * @see Codeception\Util\Mink::grabCookie()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function grabCookie($cookie) {
- $this->scenario->action('grabCookie', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Action('grabCookie', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -889,6 +1531,10 @@ class WebGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Takes a parameters from current URI by RegEx.
* If no url provided returns full URI.
*
@@ -902,13 +1548,11 @@ class WebGuy extends \Codeception\AbstractGuy
* @param null $uri
* @internal param $url
* @return mixed
- * @see Mink::grabFromCurrentUrl()
+ * @see Codeception\Util\Mink::grabFromCurrentUrl()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function grabFromCurrentUrl($uri = null) {
- $this->scenario->action('grabFromCurrentUrl', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Action('grabFromCurrentUrl', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -918,26 +1562,28 @@ class WebGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Attaches file from Codeception data directory to upload field.
*
* Example:
*
* ``` php
* attachFile('prices.xls');
+ * // file is stored in 'tests/_data/prices.xls'
+ * $I->attachFile('input[@type="file"]', 'prices.xls');
* ?>
* ```
*
* @param $field
* @param $filename
- * @see Mink::attachFile()
+ * @see Codeception\Util\Mink::attachFile()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function attachFile($field, $filename) {
- $this->scenario->action('attachFile', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Action('attachFile', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -947,6 +1593,38 @@ class WebGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks if option is selected in select field.
+ *
+ * ``` php
+ * seeOptionIsSelected('#form input[name=payment]', 'Visa');
+ * ?>
+ * ```
+ *
+ * @param $selector
+ * @param $optionText
+ * @return mixed
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Mink::seeOptionIsSelected()
+ * @return \Codeception\Maybe
+ */
+ public function canSeeOptionIsSelected($select, $text) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeOptionIsSelected', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Checks if option is selected in select field.
*
* ``` php
@@ -958,13 +1636,11 @@ class WebGuy extends \Codeception\AbstractGuy
* @param $selector
* @param $optionText
* @return mixed
- * @see Mink::seeOptionIsSelected()
+ * @see Codeception\Util\Mink::seeOptionIsSelected()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function seeOptionIsSelected($select, $text) {
- $this->scenario->assertion('seeOptionIsSelected', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Assertion('seeOptionIsSelected', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -974,6 +1650,10 @@ class WebGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Checks if option is not selected in select field.
*
* ``` php
@@ -985,43 +1665,39 @@ class WebGuy extends \Codeception\AbstractGuy
* @param $selector
* @param $optionText
* @return mixed
- * @see Mink::dontSeeOptionIsSelected()
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Mink::dontSeeOptionIsSelected()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
- public function dontSeeOptionIsSelected($select, $text) {
- $this->scenario->action('dontSeeOptionIsSelected', func_get_args());
+ public function cantSeeOptionIsSelected($select, $text) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeOptionIsSelected', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
-
-
/**
- * Assert if the specified checkbox is checked.
- * Use css selector or xpath to match.
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
*
- * Example:
+ * Checks if option is not selected in select field.
*
* ``` php
* seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms
- * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form.
- * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]');
- *
+ * $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa');
+ * ?>
* ```
*
- * @param $checkbox
- * @see Mink::seeCheckboxIsChecked()
+ * @param $selector
+ * @param $optionText
+ * @return mixed
+ * @see Codeception\Util\Mink::dontSeeOptionIsSelected()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
- public function seeCheckboxIsChecked($checkbox) {
- $this->scenario->assertion('seeCheckboxIsChecked', func_get_args());
+ public function dontSeeOptionIsSelected($select, $text) {
+ $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeOptionIsSelected', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -1031,35 +1707,44 @@ class WebGuy extends \Codeception\AbstractGuy
/**
- * Assert if the specified checkbox is unchecked.
- * Use css selector or xpath to match.
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that an input field or textarea contains value.
+ * Field is matched either by label or CSS or Xpath
*
* Example:
*
* ``` php
* dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms
- * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form.
- *
+ * $I->seeInField('Body','Type your comment here');
+ * $I->seeInField('form textarea[name=body]','Type your comment here');
+ * $I->seeInField('form input[type=hidden]','hidden_value');
+ * $I->seeInField('#searchform input','Search');
+ * $I->seeInField('//form/*[@name=search]','Search');
+ * ?>
* ```
*
- * @param $checkbox
- * @see Mink::dontSeeCheckboxIsChecked()
+ * @param $field
+ * @param $value
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Mink::seeInField()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
- public function dontSeeCheckboxIsChecked($checkbox) {
- $this->scenario->action('dontSeeCheckboxIsChecked', func_get_args());
+ public function canSeeInField($field, $value) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeInField', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
-
-
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Checks that an input field or textarea contains value.
* Field is matched either by label or CSS or Xpath
*
@@ -1077,13 +1762,11 @@ class WebGuy extends \Codeception\AbstractGuy
*
* @param $field
* @param $value
- * @see Mink::seeInField()
+ * @see Codeception\Util\Mink::seeInField()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function seeInField($field, $value) {
- $this->scenario->assertion('seeInField', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Assertion('seeInField', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -1093,6 +1776,43 @@ class WebGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that an input field or textarea doesn't contain value.
+ * Field is matched either by label or CSS or Xpath
+ * Example:
+ *
+ * ``` php
+ * dontSeeInField('Body','Type your comment here');
+ * $I->dontSeeInField('form textarea[name=body]','Type your comment here');
+ * $I->dontSeeInField('form input[type=hidden]','hidden_value');
+ * $I->dontSeeInField('#searchform input','Search');
+ * $I->dontSeeInField('//form/*[@name=search]','Search');
+ * ?>
+ * ```
+ *
+ * @param $field
+ * @param $value
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Mink::dontSeeInField()
+ * @return \Codeception\Maybe
+ */
+ public function cantSeeInField($field, $value) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeInField', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Checks that an input field or textarea doesn't contain value.
* Field is matched either by label or CSS or Xpath
* Example:
@@ -1109,13 +1829,11 @@ class WebGuy extends \Codeception\AbstractGuy
*
* @param $field
* @param $value
- * @see Mink::dontSeeInField()
+ * @see Codeception\Util\Mink::dontSeeInField()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function dontSeeInField($field, $value) {
- $this->scenario->action('dontSeeInField', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeInField', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -1125,6 +1843,10 @@ class WebGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Finds and returns text contents of element.
* Element is searched by CSS selector, XPath or matcher by regex.
*
@@ -1140,13 +1862,11 @@ class WebGuy extends \Codeception\AbstractGuy
*
* @param $cssOrXPathOrRegex
* @return mixed
- * @see Mink::grabTextFrom()
+ * @see Codeception\Util\Mink::grabTextFrom()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function grabTextFrom($cssOrXPathOrRegex) {
- $this->scenario->action('grabTextFrom', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Action('grabTextFrom', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -1156,6 +1876,10 @@ class WebGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Finds and returns field and returns it's value.
* Searches by field name, then by CSS, then by XPath
*
@@ -1171,13 +1895,66 @@ class WebGuy extends \Codeception\AbstractGuy
*
* @param $field
* @return mixed
- * @see Mink::grabValueFrom()
+ * @see Codeception\Util\Mink::grabValueFrom()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function grabValueFrom($field) {
- $this->scenario->action('grabValueFrom', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Action('grabValueFrom', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+
+
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that page title contains text.
+ *
+ * ``` php
+ * seeInTitle('Blog - Post #1');
+ * ?>
+ * ```
+ *
+ * @param $title
+ * @return mixed
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Mink::seeInTitle()
+ * @return \Codeception\Maybe
+ */
+ public function canSeeInTitle($title) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeInTitle', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that page title contains text.
+ *
+ * ``` php
+ * seeInTitle('Blog - Post #1');
+ * ?>
+ * ```
+ *
+ * @param $title
+ * @return mixed
+ * @see Codeception\Util\Mink::seeInTitle()
+ * @return \Codeception\Maybe
+ */
+ public function seeInTitle($title) {
+ $this->scenario->addStep(new \Codeception\Step\Assertion('seeInTitle', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -1187,14 +1964,40 @@ class WebGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that page title does not contain text.
+ *
+ * @param $title
+ * @return mixed
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Mink::dontSeeInTitle()
+ * @return \Codeception\Maybe
+ */
+ public function cantSeeInTitle($title) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeInTitle', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
*
- * @see Mink::grabAttribute()
+ * Checks that page title does not contain text.
+ *
+ * @param $title
+ * @return mixed
+ * @see Codeception\Util\Mink::dontSeeInTitle()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
- public function grabAttribute() {
- $this->scenario->action('grabAttribute', func_get_args());
+ public function dontSeeInTitle($title) {
+ $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeInTitle', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
diff --git a/apps/basic/tests/functional/ContactCept.php b/apps/basic/tests/functional/ContactCept.php
index 6feafd9..b58361a 100644
--- a/apps/basic/tests/functional/ContactCept.php
+++ b/apps/basic/tests/functional/ContactCept.php
@@ -4,7 +4,7 @@ $I->wantTo('ensure that contact works');
$I->amOnPage('?r=site/contact');
$I->see('Contact', 'h1');
-$I->submitForm('#contact-form', array());
+$I->submitForm('#contact-form', []);
$I->see('Contact', 'h1');
$I->see('Name cannot be blank');
$I->see('Email cannot be blank');
@@ -12,25 +12,25 @@ $I->see('Subject cannot be blank');
$I->see('Body cannot be blank');
$I->see('The verification code is incorrect');
-$I->submitForm('#contact-form', array(
+$I->submitForm('#contact-form', [
'ContactForm[name]' => 'tester',
'ContactForm[email]' => 'tester.email',
'ContactForm[subject]' => 'test subject',
'ContactForm[body]' => 'test content',
'ContactForm[verifyCode]' => 'testme',
-));
+]);
$I->dontSee('Name cannot be blank', '.help-inline');
$I->see('Email is not a valid email address.');
$I->dontSee('Subject cannot be blank', '.help-inline');
$I->dontSee('Body cannot be blank', '.help-inline');
$I->dontSee('The verification code is incorrect', '.help-inline');
-$I->submitForm('#contact-form', array(
+$I->submitForm('#contact-form', [
'ContactForm[name]' => 'tester',
'ContactForm[email]' => 'tester@example.com',
'ContactForm[subject]' => 'test subject',
'ContactForm[body]' => 'test content',
'ContactForm[verifyCode]' => 'testme',
-));
+]);
$I->dontSeeElement('#contact-form');
$I->see('Thank you for contacting us. We will respond to you as soon as possible.');
diff --git a/apps/basic/tests/functional/LoginCept.php b/apps/basic/tests/functional/LoginCept.php
index 11f8f6b..9d71378 100644
--- a/apps/basic/tests/functional/LoginCept.php
+++ b/apps/basic/tests/functional/LoginCept.php
@@ -4,20 +4,20 @@ $I->wantTo('ensure that login works');
$I->amOnPage('?r=site/login');
$I->see('Login', 'h1');
-$I->submitForm('#login-form', array());
+$I->submitForm('#login-form', []);
$I->dontSee('Logout (admin)');
$I->see('Username cannot be blank');
$I->see('Password cannot be blank');
-$I->submitForm('#login-form', array(
+$I->submitForm('#login-form', [
'LoginForm[username]' => 'admin',
'LoginForm[password]' => 'wrong',
-));
+]);
$I->dontSee('Logout (admin)');
$I->see('Incorrect username or password');
-$I->submitForm('#login-form', array(
+$I->submitForm('#login-form', [
'LoginForm[username]' => 'admin',
'LoginForm[password]' => 'admin',
-));
+]);
$I->see('Logout (admin)');
diff --git a/apps/basic/tests/functional/TestGuy.php b/apps/basic/tests/functional/TestGuy.php
index 767d564..553a44f 100644
--- a/apps/basic/tests/functional/TestGuy.php
+++ b/apps/basic/tests/functional/TestGuy.php
@@ -18,24 +18,30 @@ use Codeception\Module\Yii2;
* @method void expect($prediction)
* @method void amGoingTo($argumentation)
* @method void am($role)
- * @method void lookForwardTo($role)
+ * @method void lookForwardTo($achieveValue)
+ * @method void offsetGet($offset)
+ * @method void offsetSet($offset, $value)
+ * @method void offsetExists($offset)
+ * @method void offsetUnset($offset)
*/
class TestGuy extends \Codeception\AbstractGuy
{
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Enters a directory In local filesystem.
* Project root directory is used by default
*
* @param $path
- * @see Filesystem::amInPath()
+ * @see Codeception\Module\Filesystem::amInPath()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function amInPath($path) {
- $this->scenario->condition('amInPath', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Condition('amInPath', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -45,6 +51,10 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Opens a file and stores it's content.
*
* Usage:
@@ -57,13 +67,11 @@ class TestGuy extends \Codeception\AbstractGuy
* ```
*
* @param $filename
- * @see Filesystem::openFile()
+ * @see Codeception\Module\Filesystem::openFile()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function openFile($filename) {
- $this->scenario->action('openFile', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Action('openFile', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -73,6 +81,10 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Deletes a file
*
* ``` php
@@ -82,13 +94,11 @@ class TestGuy extends \Codeception\AbstractGuy
* ```
*
* @param $filename
- * @see Filesystem::deleteFile()
+ * @see Codeception\Module\Filesystem::deleteFile()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function deleteFile($filename) {
- $this->scenario->action('deleteFile', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Action('deleteFile', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -98,6 +108,10 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Deletes directory with all subdirectories
*
* ``` php
@@ -107,13 +121,11 @@ class TestGuy extends \Codeception\AbstractGuy
* ```
*
* @param $dirname
- * @see Filesystem::deleteDir()
+ * @see Codeception\Module\Filesystem::deleteDir()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function deleteDir($dirname) {
- $this->scenario->action('deleteDir', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Action('deleteDir', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -123,6 +135,10 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Copies directory with all contents
*
* ``` php
@@ -133,13 +149,11 @@ class TestGuy extends \Codeception\AbstractGuy
*
* @param $src
* @param $dst
- * @see Filesystem::copyDir()
+ * @see Codeception\Module\Filesystem::copyDir()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function copyDir($src, $dst) {
- $this->scenario->action('copyDir', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Action('copyDir', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -149,6 +163,39 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks If opened file has `text` in it.
+ *
+ * Usage:
+ *
+ * ``` php
+ * openFile('composer.json');
+ * $I->seeInThisFile('codeception/codeception');
+ * ?>
+ * ```
+ *
+ * @param $text
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Module\Filesystem::seeInThisFile()
+ * @return \Codeception\Maybe
+ */
+ public function canSeeInThisFile($text) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeInThisFile', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Checks If opened file has `text` in it.
*
* Usage:
@@ -161,13 +208,11 @@ class TestGuy extends \Codeception\AbstractGuy
* ```
*
* @param $text
- * @see Filesystem::seeInThisFile()
+ * @see Codeception\Module\Filesystem::seeInThisFile()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function seeInThisFile($text) {
- $this->scenario->assertion('seeInThisFile', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Assertion('seeInThisFile', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -177,6 +222,40 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks the strict matching of file contents.
+ * Unlike `seeInThisFile` will fail if file has something more then expected lines.
+ * Better to use with HEREDOC strings.
+ * Matching is done after removing "\r" chars from file content.
+ *
+ * ``` php
+ * openFile('process.pid');
+ * $I->seeFileContentsEqual('3192');
+ * ?>
+ * ```
+ *
+ * @param $text
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Module\Filesystem::seeFileContentsEqual()
+ * @return \Codeception\Maybe
+ */
+ public function canSeeFileContentsEqual($text) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeFileContentsEqual', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Checks the strict matching of file contents.
* Unlike `seeInThisFile` will fail if file has something more then expected lines.
* Better to use with HEREDOC strings.
@@ -190,13 +269,11 @@ class TestGuy extends \Codeception\AbstractGuy
* ```
*
* @param $text
- * @see Filesystem::seeFileContentsEqual()
+ * @see Codeception\Module\Filesystem::seeFileContentsEqual()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function seeFileContentsEqual($text) {
- $this->scenario->assertion('seeFileContentsEqual', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Assertion('seeFileContentsEqual', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -206,23 +283,52 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Checks If opened file doesn't contain `text` in it
*
* ``` php
* openFile('composer.json');
- * $I->seeInThisFile('codeception/codeception');
+ * $I->dontSeeInThisFile('codeception/codeception');
+ * ?>
+ * ```
+ *
+ * @param $text
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Module\Filesystem::dontSeeInThisFile()
+ * @return \Codeception\Maybe
+ */
+ public function cantSeeInThisFile($text) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeInThisFile', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks If opened file doesn't contain `text` in it
+ *
+ * ``` php
+ * openFile('composer.json');
+ * $I->dontSeeInThisFile('codeception/codeception');
* ?>
* ```
*
* @param $text
- * @see Filesystem::dontSeeInThisFile()
+ * @see Codeception\Module\Filesystem::dontSeeInThisFile()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function dontSeeInThisFile($text) {
- $this->scenario->action('dontSeeInThisFile', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeInThisFile', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -232,14 +338,16 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Deletes a file
- * @see Filesystem::deleteThisFile()
+ * @see Codeception\Module\Filesystem::deleteThisFile()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function deleteThisFile() {
- $this->scenario->action('deleteThisFile', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Action('deleteThisFile', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -249,6 +357,38 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks if file exists in path.
+ * Opens a file when it's exists
+ *
+ * ``` php
+ * seeFileFound('UserModel.php','app/models');
+ * ?>
+ * ```
+ *
+ * @param $filename
+ * @param string $path
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Module\Filesystem::seeFileFound()
+ * @return \Codeception\Maybe
+ */
+ public function canSeeFileFound($filename, $path = null) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeFileFound', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Checks if file exists in path.
* Opens a file when it's exists
*
@@ -260,13 +400,11 @@ class TestGuy extends \Codeception\AbstractGuy
*
* @param $filename
* @param string $path
- * @see Filesystem::seeFileFound()
+ * @see Codeception\Module\Filesystem::seeFileFound()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function seeFileFound($filename, $path = null) {
- $this->scenario->assertion('seeFileFound', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Assertion('seeFileFound', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -276,6 +414,10 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Erases directory contents
*
* ``` php
@@ -285,13 +427,11 @@ class TestGuy extends \Codeception\AbstractGuy
* ```
*
* @param $dirname
- * @see Filesystem::cleanDir()
+ * @see Codeception\Module\Filesystem::cleanDir()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function cleanDir($dirname) {
- $this->scenario->action('cleanDir', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Action('cleanDir', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -301,17 +441,19 @@ class TestGuy extends \Codeception\AbstractGuy
/**
- * Adds HTTP authentication via username/password.
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Authenticates user for HTTP_AUTH
*
* @param $username
* @param $password
- * @see Framework::amHttpAuthenticated()
+ * @see Codeception\Util\Framework::amHttpAuthenticated()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function amHttpAuthenticated($username, $password) {
- $this->scenario->condition('amHttpAuthenticated', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Condition('amHttpAuthenticated', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -321,6 +463,10 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Opens the page.
* Requires relative uri as parameter
*
@@ -336,13 +482,11 @@ class TestGuy extends \Codeception\AbstractGuy
* ```
*
* @param $page
- * @see Framework::amOnPage()
+ * @see Codeception\Util\Framework::amOnPage()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function amOnPage($page) {
- $this->scenario->condition('amOnPage', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Condition('amOnPage', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -352,6 +496,10 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Perform a click on link or button.
* Link or button are found by their names or CSS selector.
* Submits a form if button is a submit type.
@@ -380,13 +528,11 @@ class TestGuy extends \Codeception\AbstractGuy
* ```
* @param $link
* @param $context
- * @see Framework::click()
+ * @see Codeception\Util\Framework::click()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function click($link, $context = null) {
- $this->scenario->action('click', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Action('click', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -396,6 +542,10 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Check if current page contains the text specified.
* Specify the css selector to match only specific region.
*
@@ -406,18 +556,48 @@ class TestGuy extends \Codeception\AbstractGuy
* $I->see('Logout'); // I can suppose user is logged in
* $I->see('Sign Up','h1'); // I can suppose it's a signup page
* $I->see('Sign Up','//body/h1'); // with XPath
+ * ?>
+ * ```
+ *
+ * @param $text
+ * @param null $selector
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Framework::see()
+ * @return \Codeception\Maybe
+ */
+ public function canSee($text, $selector = null) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('see', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Check if current page contains the text specified.
+ * Specify the css selector to match only specific region.
+ *
+ * Examples:
*
+ * ``` php
+ * see('Logout'); // I can suppose user is logged in
+ * $I->see('Sign Up','h1'); // I can suppose it's a signup page
+ * $I->see('Sign Up','//body/h1'); // with XPath
+ * ?>
* ```
*
* @param $text
* @param null $selector
- * @see Framework::see()
+ * @see Codeception\Util\Framework::see()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function see($text, $selector = null) {
- $this->scenario->assertion('see', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Assertion('see', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -427,6 +607,42 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Check if current page doesn't contain the text specified.
+ * Specify the css selector to match only specific region.
+ *
+ * Examples:
+ *
+ * ```php
+ * dontSee('Login'); // I can suppose user is already logged in
+ * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page
+ * $I->dontSee('Sign Up','//body/h1'); // with XPath
+ * ?>
+ * ```
+ *
+ * @param $text
+ * @param null $selector
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Framework::dontSee()
+ * @return \Codeception\Maybe
+ */
+ public function cantSee($text, $selector = null) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSee', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Check if current page doesn't contain the text specified.
* Specify the css selector to match only specific region.
*
@@ -437,17 +653,16 @@ class TestGuy extends \Codeception\AbstractGuy
* $I->dontSee('Login'); // I can suppose user is already logged in
* $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page
* $I->dontSee('Sign Up','//body/h1'); // with XPath
+ * ?>
* ```
*
* @param $text
* @param null $selector
- * @see Framework::dontSee()
+ * @see Codeception\Util\Framework::dontSee()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function dontSee($text, $selector = null) {
- $this->scenario->action('dontSee', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Assertion('dontSee', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -457,6 +672,10 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Checks if there is a link with text specified.
* Specify url to match link with exact this url.
*
@@ -466,18 +685,47 @@ class TestGuy extends \Codeception\AbstractGuy
* seeLink('Logout'); // matches Logout
* $I->seeLink('Logout','/logout'); // matches Logout
+ * ?>
+ * ```
+ *
+ * @param $text
+ * @param null $url
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Framework::seeLink()
+ * @return \Codeception\Maybe
+ */
+ public function canSeeLink($text, $url = null) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeLink', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
*
+ * Checks if there is a link with text specified.
+ * Specify url to match link with exact this url.
+ *
+ * Examples:
+ *
+ * ``` php
+ * seeLink('Logout'); // matches Logout
+ * $I->seeLink('Logout','/logout'); // matches Logout
+ * ?>
* ```
*
* @param $text
* @param null $url
- * @see Framework::seeLink()
+ * @see Codeception\Util\Framework::seeLink()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function seeLink($text, $url = null) {
- $this->scenario->assertion('seeLink', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Assertion('seeLink', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -487,6 +735,10 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Checks if page doesn't contain the link with text specified.
* Specify url to narrow the results.
*
@@ -495,46 +747,46 @@ class TestGuy extends \Codeception\AbstractGuy
* ``` php
* dontSeeLink('Logout'); // I suppose user is not logged in
- *
+ * ?>
* ```
*
* @param $text
* @param null $url
- * @see Framework::dontSeeLink()
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Framework::dontSeeLink()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
- public function dontSeeLink($text, $url = null) {
- $this->scenario->action('dontSeeLink', func_get_args());
+ public function cantSeeLink($text, $url = null) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeLink', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
-
-
/**
- * Checks that current uri contains a value
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks if page doesn't contain the link with text specified.
+ * Specify url to narrow the results.
+ *
+ * Examples:
*
* ``` php
* seeInCurrentUrl('home');
- * // to match: /users/1
- * $I->seeInCurrentUrl('/users/');
+ * $I->dontSeeLink('Logout'); // I suppose user is not logged in
* ?>
* ```
*
- * @param $uri
- * @see Framework::seeInCurrentUrl()
+ * @param $text
+ * @param null $url
+ * @see Codeception\Util\Framework::dontSeeLink()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
- public function seeInCurrentUrl($uri) {
- $this->scenario->assertion('seeInCurrentUrl', func_get_args());
+ public function dontSeeLink($text, $url = null) {
+ $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeLink', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -544,47 +796,56 @@ class TestGuy extends \Codeception\AbstractGuy
/**
- * Checks that current uri does not contain a value
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that current uri contains a value
*
* ``` php
* dontSeeInCurrentUrl('/users/');
+ * // to match: /home/dashboard
+ * $I->seeInCurrentUrl('home');
+ * // to match: /users/1
+ * $I->seeInCurrentUrl('/users/');
* ?>
* ```
*
* @param $uri
- * @see Framework::dontSeeInCurrentUrl()
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Framework::seeInCurrentUrl()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
- public function dontSeeInCurrentUrl($uri) {
- $this->scenario->action('dontSeeInCurrentUrl', func_get_args());
+ public function canSeeInCurrentUrl($uri) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeInCurrentUrl', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
-
-
/**
- * Checks that current url is equal to value.
- * Unlike `seeInCurrentUrl` performs a strict check.
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that current uri contains a value
*
+ * ``` php
* seeCurrentUrlEquals('/');
+ * // to match: /home/dashboard
+ * $I->seeInCurrentUrl('home');
+ * // to match: /users/1
+ * $I->seeInCurrentUrl('/users/');
* ?>
+ * ```
*
* @param $uri
- * @see Framework::seeCurrentUrlEquals()
+ * @see Codeception\Util\Framework::seeInCurrentUrl()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
- public function seeCurrentUrlEquals($uri) {
- $this->scenario->assertion('seeCurrentUrlEquals', func_get_args());
+ public function seeInCurrentUrl($uri) {
+ $this->scenario->addStep(new \Codeception\Step\Assertion('seeInCurrentUrl', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -594,46 +855,50 @@ class TestGuy extends \Codeception\AbstractGuy
/**
- * Checks that current url is not equal to value.
- * Unlike `dontSeeInCurrentUrl` performs a strict check.
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that current uri does not contain a value
*
+ * ``` php
* dontSeeCurrentUrlEquals('/');
+ * $I->dontSeeInCurrentUrl('/users/');
* ?>
+ * ```
*
* @param $uri
- * @see Framework::dontSeeCurrentUrlEquals()
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Framework::dontSeeInCurrentUrl()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
- public function dontSeeCurrentUrlEquals($uri) {
- $this->scenario->action('dontSeeCurrentUrlEquals', func_get_args());
+ public function cantSeeInCurrentUrl($uri) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeInCurrentUrl', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
-
-
/**
- * Checks that current url is matches a RegEx value
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that current uri does not contain a value
*
+ * ``` php
* seeCurrentUrlMatches('~$/users/(\d+)~');
+ * $I->dontSeeInCurrentUrl('/users/');
* ?>
+ * ```
*
* @param $uri
- * @see Framework::seeCurrentUrlMatches()
+ * @see Codeception\Util\Framework::dontSeeInCurrentUrl()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
- public function seeCurrentUrlMatches($uri) {
- $this->scenario->assertion('seeCurrentUrlMatches', func_get_args());
+ public function dontSeeInCurrentUrl($uri) {
+ $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeInCurrentUrl', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -643,21 +908,166 @@ class TestGuy extends \Codeception\AbstractGuy
/**
- * Checks that current url does not match a RegEx value
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
*
+ * Checks that current url is equal to value.
+ * Unlike `seeInCurrentUrl` performs a strict check.
+ *
+ * ``` php
* dontSeeCurrentUrlMatches('~$/users/(\d+)~');
+ * $I->seeCurrentUrlEquals('/');
* ?>
+ * ```
*
* @param $uri
- * @see Framework::dontSeeCurrentUrlMatches()
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Framework::seeCurrentUrlEquals()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
- public function dontSeeCurrentUrlMatches($uri) {
- $this->scenario->action('dontSeeCurrentUrlMatches', func_get_args());
+ public function canSeeCurrentUrlEquals($uri) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlEquals', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that current url is equal to value.
+ * Unlike `seeInCurrentUrl` performs a strict check.
+ *
+ * ``` php
+ * seeCurrentUrlEquals('/');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * @see Codeception\Util\Framework::seeCurrentUrlEquals()
+ * @return \Codeception\Maybe
+ */
+ public function seeCurrentUrlEquals($uri) {
+ $this->scenario->addStep(new \Codeception\Step\Assertion('seeCurrentUrlEquals', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+
+
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that current url is not equal to value.
+ * Unlike `dontSeeInCurrentUrl` performs a strict check.
+ *
+ * ``` php
+ * dontSeeCurrentUrlEquals('/');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Framework::dontSeeCurrentUrlEquals()
+ * @return \Codeception\Maybe
+ */
+ public function cantSeeCurrentUrlEquals($uri) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlEquals', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that current url is not equal to value.
+ * Unlike `dontSeeInCurrentUrl` performs a strict check.
+ *
+ * ``` php
+ * dontSeeCurrentUrlEquals('/');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * @see Codeception\Util\Framework::dontSeeCurrentUrlEquals()
+ * @return \Codeception\Maybe
+ */
+ public function dontSeeCurrentUrlEquals($uri) {
+ $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlEquals', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+
+
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that current url is matches a RegEx value
+ *
+ * ``` php
+ * seeCurrentUrlMatches('~$/users/(\d+)~');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Framework::seeCurrentUrlMatches()
+ * @return \Codeception\Maybe
+ */
+ public function canSeeCurrentUrlMatches($uri) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlMatches', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that current url is matches a RegEx value
+ *
+ * ``` php
+ * seeCurrentUrlMatches('~$/users/(\d+)~');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * @see Codeception\Util\Framework::seeCurrentUrlMatches()
+ * @return \Codeception\Maybe
+ */
+ public function seeCurrentUrlMatches($uri) {
+ $this->scenario->addStep(new \Codeception\Step\Assertion('seeCurrentUrlMatches', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -667,6 +1077,65 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that current url does not match a RegEx value
+ *
+ * ``` php
+ * dontSeeCurrentUrlMatches('~$/users/(\d+)~');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Framework::dontSeeCurrentUrlMatches()
+ * @return \Codeception\Maybe
+ */
+ public function cantSeeCurrentUrlMatches($uri) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlMatches', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that current url does not match a RegEx value
+ *
+ * ``` php
+ * dontSeeCurrentUrlMatches('~$/users/(\d+)~');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * @see Codeception\Util\Framework::dontSeeCurrentUrlMatches()
+ * @return \Codeception\Maybe
+ */
+ public function dontSeeCurrentUrlMatches($uri) {
+ $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlMatches', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+
+
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Takes a parameters from current URI by RegEx.
* If no url provided returns full URI.
*
@@ -680,13 +1149,11 @@ class TestGuy extends \Codeception\AbstractGuy
* @param null $uri
* @internal param $url
* @return mixed
- * @see Framework::grabFromCurrentUrl()
+ * @see Codeception\Util\Framework::grabFromCurrentUrl()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function grabFromCurrentUrl($uri = null) {
- $this->scenario->action('grabFromCurrentUrl', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Action('grabFromCurrentUrl', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -696,6 +1163,10 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Assert if the specified checkbox is checked.
* Use css selector or xpath to match.
*
@@ -706,17 +1177,46 @@ class TestGuy extends \Codeception\AbstractGuy
* $I->seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms
* $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form.
* $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]');
+ * ?>
+ * ```
*
+ * @param $checkbox
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Framework::seeCheckboxIsChecked()
+ * @return \Codeception\Maybe
+ */
+ public function canSeeCheckboxIsChecked($checkbox) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeCheckboxIsChecked', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Assert if the specified checkbox is checked.
+ * Use css selector or xpath to match.
+ *
+ * Example:
+ *
+ * ``` php
+ * seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms
+ * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form.
+ * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]');
+ * ?>
* ```
*
* @param $checkbox
- * @see Framework::seeCheckboxIsChecked()
+ * @see Codeception\Util\Framework::seeCheckboxIsChecked()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function seeCheckboxIsChecked($checkbox) {
- $this->scenario->assertion('seeCheckboxIsChecked', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Assertion('seeCheckboxIsChecked', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -726,6 +1226,10 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Assert if the specified checkbox is unchecked.
* Use css selector or xpath to match.
*
@@ -735,17 +1239,45 @@ class TestGuy extends \Codeception\AbstractGuy
* dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms
* $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form.
+ * ?>
+ * ```
*
+ * @param $checkbox
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Framework::dontSeeCheckboxIsChecked()
+ * @return \Codeception\Maybe
+ */
+ public function cantSeeCheckboxIsChecked($checkbox) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeCheckboxIsChecked', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Assert if the specified checkbox is unchecked.
+ * Use css selector or xpath to match.
+ *
+ * Example:
+ *
+ * ``` php
+ * dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms
+ * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form.
+ * ?>
* ```
*
* @param $checkbox
- * @see Framework::dontSeeCheckboxIsChecked()
+ * @see Codeception\Util\Framework::dontSeeCheckboxIsChecked()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function dontSeeCheckboxIsChecked($checkbox) {
- $this->scenario->action('dontSeeCheckboxIsChecked', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeCheckboxIsChecked', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -755,6 +1287,44 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that an input field or textarea contains value.
+ * Field is matched either by label or CSS or Xpath
+ *
+ * Example:
+ *
+ * ``` php
+ * seeInField('Body','Type your comment here');
+ * $I->seeInField('form textarea[name=body]','Type your comment here');
+ * $I->seeInField('form input[type=hidden]','hidden_value');
+ * $I->seeInField('#searchform input','Search');
+ * $I->seeInField('//form/*[@name=search]','Search');
+ * ?>
+ * ```
+ *
+ * @param $field
+ * @param $value
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Framework::seeInField()
+ * @return \Codeception\Maybe
+ */
+ public function canSeeInField($field, $value) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeInField', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Checks that an input field or textarea contains value.
* Field is matched either by label or CSS or Xpath
*
@@ -772,13 +1342,11 @@ class TestGuy extends \Codeception\AbstractGuy
*
* @param $field
* @param $value
- * @see Framework::seeInField()
+ * @see Codeception\Util\Framework::seeInField()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function seeInField($field, $value) {
- $this->scenario->assertion('seeInField', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Assertion('seeInField', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -788,6 +1356,10 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Checks that an input field or textarea doesn't contain value.
* Field is matched either by label or CSS or Xpath
* Example:
@@ -804,13 +1376,44 @@ class TestGuy extends \Codeception\AbstractGuy
*
* @param $field
* @param $value
- * @see Framework::dontSeeInField()
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Framework::dontSeeInField()
+ * @return \Codeception\Maybe
+ */
+ public function cantSeeInField($field, $value) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeInField', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that an input field or textarea doesn't contain value.
+ * Field is matched either by label or CSS or Xpath
+ * Example:
+ *
+ * ``` php
+ * dontSeeInField('Body','Type your comment here');
+ * $I->dontSeeInField('form textarea[name=body]','Type your comment here');
+ * $I->dontSeeInField('form input[type=hidden]','hidden_value');
+ * $I->dontSeeInField('#searchform input','Search');
+ * $I->dontSeeInField('//form/*[@name=search]','Search');
+ * ?>
+ * ```
+ *
+ * @param $field
+ * @param $value
+ * @see Codeception\Util\Framework::dontSeeInField()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function dontSeeInField($field, $value) {
- $this->scenario->action('dontSeeInField', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeInField', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -820,6 +1423,10 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Submits a form located on page.
* Specify the form by it's css or xpath selector.
* Fill the form fields values as array.
@@ -858,13 +1465,11 @@ class TestGuy extends \Codeception\AbstractGuy
*
* @param $selector
* @param $params
- * @see Framework::submitForm()
+ * @see Codeception\Util\Framework::submitForm()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function submitForm($selector, $params) {
- $this->scenario->action('submitForm', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Action('submitForm', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -874,17 +1479,27 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Fills a text field or textarea with value.
+ *
+ * Example:
+ *
+ * ``` php
+ * fillField("//input[@type='text']", "Hello World!");
+ * ?>
+ * ```
*
* @param $field
* @param $value
- * @see Framework::fillField()
+ * @see Codeception\Util\Framework::fillField()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function fillField($field, $value) {
- $this->scenario->action('fillField', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Action('fillField', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -894,6 +1509,10 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Selects an option in select tag or in radio button group.
*
* Example:
@@ -906,15 +1525,21 @@ class TestGuy extends \Codeception\AbstractGuy
* ?>
* ```
*
+ * Can select multiple options if second argument is array:
+ *
+ * ``` php
+ * selectOption('Which OS do you use?', array('Windows','Linux'));
+ * ?>
+ * ```
+ *
* @param $select
* @param $option
- * @see Framework::selectOption()
+ * @see Codeception\Util\Framework::selectOption()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function selectOption($select, $option) {
- $this->scenario->action('selectOption', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Action('selectOption', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -924,6 +1549,10 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Ticks a checkbox.
* For radio buttons use `selectOption` method.
*
@@ -936,13 +1565,11 @@ class TestGuy extends \Codeception\AbstractGuy
* ```
*
* @param $option
- * @see Framework::checkOption()
+ * @see Codeception\Util\Framework::checkOption()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function checkOption($option) {
- $this->scenario->action('checkOption', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Action('checkOption', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -952,6 +1579,10 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Unticks a checkbox.
*
* Example:
@@ -963,13 +1594,11 @@ class TestGuy extends \Codeception\AbstractGuy
* ```
*
* @param $option
- * @see Framework::uncheckOption()
+ * @see Codeception\Util\Framework::uncheckOption()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function uncheckOption($option) {
- $this->scenario->action('uncheckOption', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Action('uncheckOption', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -979,26 +1608,28 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Attaches file from Codeception data directory to upload field.
*
* Example:
*
* ``` php
* attachFile('prices.xls');
+ * // file is stored in 'tests/_data/prices.xls'
+ * $I->attachFile('input[@type="file"]', 'prices.xls');
* ?>
* ```
*
* @param $field
* @param $filename
- * @see Framework::attachFile()
+ * @see Codeception\Util\Framework::attachFile()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function attachFile($field, $filename) {
- $this->scenario->action('attachFile', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Action('attachFile', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -1008,6 +1639,10 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* If your page triggers an ajax request, you can perform it manually.
* This action sends a GET ajax request with specified params.
*
@@ -1015,13 +1650,11 @@ class TestGuy extends \Codeception\AbstractGuy
*
* @param $uri
* @param $params
- * @see Framework::sendAjaxGetRequest()
+ * @see Codeception\Util\Framework::sendAjaxGetRequest()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function sendAjaxGetRequest($uri, $params = null) {
- $this->scenario->action('sendAjaxGetRequest', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Action('sendAjaxGetRequest', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -1031,6 +1664,10 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* If your page triggers an ajax request, you can perform it manually.
* This action sends a POST ajax request with specified params.
* Additional params can be passed as array.
@@ -1049,13 +1686,11 @@ class TestGuy extends \Codeception\AbstractGuy
*
* @param $uri
* @param $params
- * @see Framework::sendAjaxPostRequest()
+ * @see Codeception\Util\Framework::sendAjaxPostRequest()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function sendAjaxPostRequest($uri, $params = null) {
- $this->scenario->action('sendAjaxPostRequest', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Action('sendAjaxPostRequest', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -1065,23 +1700,10 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
*
- * @see Framework::formatResponse()
- * @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
- */
- public function formatResponse($response) {
- $this->scenario->action('formatResponse', func_get_args());
- if ($this->scenario->running()) {
- $result = $this->scenario->runStep();
- return new Maybe($result);
- }
- return new Maybe();
- }
-
-
- /**
* Finds and returns text contents of element.
* Element is searched by CSS selector, XPath or matcher by regex.
*
@@ -1097,13 +1719,11 @@ class TestGuy extends \Codeception\AbstractGuy
*
* @param $cssOrXPathOrRegex
* @return mixed
- * @see Framework::grabTextFrom()
+ * @see Codeception\Util\Framework::grabTextFrom()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function grabTextFrom($cssOrXPathOrRegex) {
- $this->scenario->action('grabTextFrom', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Action('grabTextFrom', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -1113,6 +1733,10 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Finds and returns field and returns it's value.
* Searches by field name, then by CSS, then by XPath
*
@@ -1128,13 +1752,11 @@ class TestGuy extends \Codeception\AbstractGuy
*
* @param $field
* @return mixed
- * @see Framework::grabValueFrom()
+ * @see Codeception\Util\Framework::grabValueFrom()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function grabValueFrom($field) {
- $this->scenario->action('grabValueFrom', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Action('grabValueFrom', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -1144,22 +1766,50 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Checks if element exists on a page, matching it by CSS or XPath
*
* ``` php
* seeElement('.error');
- * $I->seeElement(//form/input[1]);
+ * $I->seeElement('//form/input[1]');
* ?>
* ```
* @param $selector
- * @see Framework::seeElement()
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Framework::seeElement()
+ * @return \Codeception\Maybe
+ */
+ public function canSeeElement($selector) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeElement', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks if element exists on a page, matching it by CSS or XPath
+ *
+ * ``` php
+ * seeElement('.error');
+ * $I->seeElement('//form/input[1]');
+ * ?>
+ * ```
+ * @param $selector
+ * @see Codeception\Util\Framework::seeElement()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function seeElement($selector) {
- $this->scenario->assertion('seeElement', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Assertion('seeElement', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -1169,22 +1819,54 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks if element does not exist (or is visible) on a page, matching it by CSS or XPath
+ *
+ * Example:
+ *
+ * ``` php
+ * dontSeeElement('.error');
+ * $I->dontSeeElement('//form/input[1]');
+ * ?>
+ * ```
+ * @param $selector
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Framework::dontSeeElement()
+ * @return \Codeception\Maybe
+ */
+ public function cantSeeElement($selector) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeElement', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Checks if element does not exist (or is visible) on a page, matching it by CSS or XPath
*
+ * Example:
+ *
* ``` php
* dontSeeElement('.error');
- * $I->dontSeeElement(//form/input[1]);
+ * $I->dontSeeElement('//form/input[1]');
* ?>
* ```
* @param $selector
- * @see Framework::dontSeeElement()
+ * @see Codeception\Util\Framework::dontSeeElement()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function dontSeeElement($selector) {
- $this->scenario->action('dontSeeElement', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeElement', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -1194,6 +1876,10 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Checks if option is selected in select field.
*
* ``` php
@@ -1205,13 +1891,39 @@ class TestGuy extends \Codeception\AbstractGuy
* @param $selector
* @param $optionText
* @return mixed
- * @see Framework::seeOptionIsSelected()
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Framework::seeOptionIsSelected()
+ * @return \Codeception\Maybe
+ */
+ public function canSeeOptionIsSelected($select, $optionText) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeOptionIsSelected', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks if option is selected in select field.
+ *
+ * ``` php
+ * seeOptionIsSelected('#form input[name=payment]', 'Visa');
+ * ?>
+ * ```
+ *
+ * @param $selector
+ * @param $optionText
+ * @return mixed
+ * @see Codeception\Util\Framework::seeOptionIsSelected()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function seeOptionIsSelected($select, $optionText) {
- $this->scenario->assertion('seeOptionIsSelected', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Assertion('seeOptionIsSelected', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -1221,6 +1933,10 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Checks if option is not selected in select field.
*
* ``` php
@@ -1232,13 +1948,39 @@ class TestGuy extends \Codeception\AbstractGuy
* @param $selector
* @param $optionText
* @return mixed
- * @see Framework::dontSeeOptionIsSelected()
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Framework::dontSeeOptionIsSelected()
+ * @return \Codeception\Maybe
+ */
+ public function cantSeeOptionIsSelected($select, $optionText) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeOptionIsSelected', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks if option is not selected in select field.
+ *
+ * ``` php
+ * dontSeeOptionIsSelected('#form input[name=payment]', 'Visa');
+ * ?>
+ * ```
+ *
+ * @param $selector
+ * @param $optionText
+ * @return mixed
+ * @see Codeception\Util\Framework::dontSeeOptionIsSelected()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function dontSeeOptionIsSelected($select, $optionText) {
- $this->scenario->action('dontSeeOptionIsSelected', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeOptionIsSelected', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -1248,14 +1990,34 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Asserts that current page has 404 response status code.
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Framework::seePageNotFound()
+ * @return \Codeception\Maybe
+ */
+ public function canSeePageNotFound() {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seePageNotFound', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Asserts that current page has 404 response status code.
- * @see Framework::seePageNotFound()
+ * @see Codeception\Util\Framework::seePageNotFound()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function seePageNotFound() {
- $this->scenario->assertion('seePageNotFound', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Assertion('seePageNotFound', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
@@ -1265,17 +2027,138 @@ class TestGuy extends \Codeception\AbstractGuy
/**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
* Checks that response code is equal to value provided.
*
* @param $code
* @return mixed
- * @see Framework::seeResponseCodeIs()
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Framework::seeResponseCodeIs()
+ * @return \Codeception\Maybe
+ */
+ public function canSeeResponseCodeIs($code) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIs', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that response code is equal to value provided.
+ *
+ * @param $code
+ * @return mixed
+ * @see Codeception\Util\Framework::seeResponseCodeIs()
* @return \Codeception\Maybe
- * ! This method is generated. DO NOT EDIT. !
- * ! Documentation taken from corresponding module !
*/
public function seeResponseCodeIs($code) {
- $this->scenario->assertion('seeResponseCodeIs', func_get_args());
+ $this->scenario->addStep(new \Codeception\Step\Assertion('seeResponseCodeIs', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+
+
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that page title contains text.
+ *
+ * ``` php
+ * seeInTitle('Blog - Post #1');
+ * ?>
+ * ```
+ *
+ * @param $title
+ * @return mixed
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Framework::seeInTitle()
+ * @return \Codeception\Maybe
+ */
+ public function canSeeInTitle($title) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeInTitle', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that page title contains text.
+ *
+ * ``` php
+ * seeInTitle('Blog - Post #1');
+ * ?>
+ * ```
+ *
+ * @param $title
+ * @return mixed
+ * @see Codeception\Util\Framework::seeInTitle()
+ * @return \Codeception\Maybe
+ */
+ public function seeInTitle($title) {
+ $this->scenario->addStep(new \Codeception\Step\Assertion('seeInTitle', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+
+
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that page title does not contain text.
+ *
+ * @param $title
+ * @return mixed
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see Codeception\Util\Framework::dontSeeInTitle()
+ * @return \Codeception\Maybe
+ */
+ public function cantSeeInTitle($title) {
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeInTitle', func_get_args()));
+ if ($this->scenario->running()) {
+ $result = $this->scenario->runStep();
+ return new Maybe($result);
+ }
+ return new Maybe();
+ }
+ /**
+ * This method is generated.
+ * Documentation taken from corresponding module.
+ * ----------------------------------------------
+ *
+ * Checks that page title does not contain text.
+ *
+ * @param $title
+ * @return mixed
+ * @see Codeception\Util\Framework::dontSeeInTitle()
+ * @return \Codeception\Maybe
+ */
+ public function dontSeeInTitle($title) {
+ $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeInTitle', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
diff --git a/apps/basic/tests/unit/CodeGuy.php b/apps/basic/tests/unit/CodeGuy.php
index adcd618..613c754 100644
--- a/apps/basic/tests/unit/CodeGuy.php
+++ b/apps/basic/tests/unit/CodeGuy.php
@@ -1,23 +1,26 @@
beginPage(); ?>
-
+
-
- This is the About page. You may modify the following file to customize its content:
-
+ = __FILE__ ?>
diff --git a/apps/basic/views/site/index.php b/apps/basic/views/site/index.php index f2e6d5e..bcb2278 100644 --- a/apps/basic/views/site/index.php +++ b/apps/basic/views/site/index.php @@ -1,6 +1,6 @@ title = 'My Yii Application'; ?> diff --git a/apps/basic/views/site/login.php b/apps/basic/views/site/login.php index f61d9d7..da022d6 100644 --- a/apps/basic/views/site/login.php +++ b/apps/basic/views/site/login.php @@ -3,7 +3,7 @@ use yii\helpers\Html; use yii\widgets\ActiveForm; /** - * @var yii\base\View $this + * @var yii\web\View $this * @var yii\widgets\ActiveForm $form * @var app\models\LoginForm $model */ @@ -11,30 +11,30 @@ $this->title = 'Login'; $this->params['breadcrumbs'][] = $this->title; ?>
Please fill out the following fields to login:
- 'login-form', - 'options' => array('class' => 'form-horizontal'), - 'fieldConfig' => array( + 'options' => ['class' => 'form-horizontal'], + 'fieldConfig' => [ 'template' => "{label}\n