From 4ba6fe13b307a4a28f8e99cb81f0fbe7ddd3b08d Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Sun, 22 Mar 2015 20:14:19 +0100 Subject: [PATCH 001/287] added travis.yml --- .travis.yml | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..dc8724f4e --- /dev/null +++ b/.travis.yml @@ -0,0 +1,47 @@ +language: php + +php: + - 5.4 + - 5.5 + - 5.6 + - 7.0 +# - hhvm +# - hhvm-nightly + +# run build against hhvm but allow them to fail +# http://docs.travis-ci.com/user/build-configuration/#Rows-That-are-Allowed-To-Fail +matrix: + fast_finish: true + allow_failures: +# - php: hhvm-nightly + - php: 7.0 + +# faster builds on new travis setup not using sudo +sudo: false + +# cache vendor dirs +cache: + directories: + - vendor + - $HOME/.composer/cache + +install: + - travis_retry composer self-update && composer --version + - travis_retry composer global require "fxp/composer-asset-plugin:1.0.0" + - export PATH="$HOME/.composer/vendor/bin:$PATH" + - travis_retry composer install --dev --prefer-dist --no-interaction +# codeception + - travis_retry composer global require "codeception/codeception=2.0.*" "codeception/specify=*" "codeception/verify=*" +# setup application: + - | + sed -i "s/'cookieValidationKey' => ''/'cookieValidationKey' => 'testkey'/" config/web.php + cd tests + codecept build + cd .. + +script: + - | + cd web + php -S localhost:8080 > /dev/null 2>&1 & + cd ../tests + codecept run From 5b0679bddeb1139a5aa0f74d5ac5c1c415e0288b Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Sun, 22 Mar 2015 20:19:01 +0100 Subject: [PATCH 002/287] added travis and packagist badges --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index c5bec59a4..c0d14d56b 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,9 @@ The template contains the basic features including user login/logout and a conta It includes all commonly used configurations that would allow you to focus on adding new features to your application. +[![Latest Stable Version](https://poser.pugx.org/yiisoft/yii2-app-basic/v/stable.png)](https://packagist.org/packages/yiisoft/yii2-app-basic) +[![Total Downloads](https://poser.pugx.org/yiisoft/yii2-app-basic/downloads.png)](https://packagist.org/packages/yiisoft/yii2-app-basic) +[![Build Status](https://travis-ci.org/yiisoft/yii2-app-basic.svg?branch=master)](https://travis-ci.org/yiisoft/yii2-app-basic) DIRECTORY STRUCTURE ------------------- From b20814fea9e717215161aebcee329221770e1b31 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Sun, 22 Mar 2015 21:55:09 +0100 Subject: [PATCH 003/287] update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c0d14d56b..7245bcb6a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Yii 2 Basic Application Template ================================ -Yii 2 Basic Application Template is a skeleton Yii 2 application best for +Yii 2 Basic Application Template is a skeleton [Yii 2](http://www.yiiframework.com/) application best for rapidly creating small projects. The template contains the basic features including user login/logout and a contact page. From d091d08d17ebbd24be574a89b8050720dd511db7 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Thu, 2 Apr 2015 16:09:56 +0300 Subject: [PATCH 004/287] Renamed application template into project template in docs --- README.md | 10 +++++----- composer.json | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 7245bcb6a..587e755b8 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -Yii 2 Basic Application Template -================================ +Yii 2 Basic Project Template +============================ -Yii 2 Basic Application Template is a skeleton [Yii 2](http://www.yiiframework.com/) application best for +Yii 2 Basic Project Template is a skeleton [Yii 2](http://www.yiiframework.com/) application best for rapidly creating small projects. The template contains the basic features including user login/logout and a contact page. @@ -32,7 +32,7 @@ DIRECTORY STRUCTURE REQUIREMENTS ------------ -The minimum requirement by this application template that your Web server supports PHP 5.4.0. +The minimum requirement by this project template that your Web server supports PHP 5.4.0. INSTALLATION @@ -55,7 +55,7 @@ http://localhost/basic/web/ If you do not have [Composer](http://getcomposer.org/), you may install it by following the instructions at [getcomposer.org](http://getcomposer.org/doc/00-intro.md#installation-nix). -You can then install this application template using the following command: +You can then install this project template using the following command: ~~~ php composer.phar global require "fxp/composer-asset-plugin:1.0.0" diff --git a/composer.json b/composer.json index 56756ec81..a5cc0db57 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "yiisoft/yii2-app-basic", - "description": "Yii 2 Basic Application Template", - "keywords": ["yii2", "framework", "basic", "application template"], + "description": "Yii 2 Basic Project Template", + "keywords": ["yii2", "framework", "basic", "project template"], "homepage": "http://www.yiiframework.com/", "type": "project", "license": "BSD-3-Clause", From d72cfa6b634841569558326768b507eb5030ebd0 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Fri, 3 Apr 2015 00:48:16 +0300 Subject: [PATCH 005/287] Added .gitattributes --- .gitattributes | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..db48bac2b --- /dev/null +++ b/.gitattributes @@ -0,0 +1,7 @@ +# Ignore all test and documentation for archive +/.gitattributes export-ignore +/.gitignore export-ignore +/.scrutinizer.yml export-ignore +/.travis.yml export-ignore +/phpunit.xml.dist export-ignore +/docs export-ignore From 70148b06d83e22ce59399b565c2d86ff2a2d3d03 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Tue, 7 Apr 2015 12:32:38 +0300 Subject: [PATCH 006/287] Removed .gitignore from .gitattributes --- .gitattributes | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitattributes b/.gitattributes index db48bac2b..6b9d3d398 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,7 +1,5 @@ # Ignore all test and documentation for archive /.gitattributes export-ignore -/.gitignore export-ignore /.scrutinizer.yml export-ignore /.travis.yml export-ignore -/phpunit.xml.dist export-ignore /docs export-ignore From f71c712b8dd0036f78ef0e1394e8a229b31ae275 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Tue, 7 Apr 2015 13:00:08 +0300 Subject: [PATCH 007/287] Removed vendor from travis cache because it causes git build errors --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index dc8724f4e..8a9bd1cfb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,6 @@ sudo: false # cache vendor dirs cache: directories: - - vendor - $HOME/.composer/cache install: From 8ed0dfbdeb46f16b13e35fb76e5fd832ee8ad35a Mon Sep 17 00:00:00 2001 From: BlueZED Date: Wed, 22 Apr 2015 10:06:08 +0200 Subject: [PATCH 008/287] Fix for issue #5 Apply the template to the checkbox, not the field. --- views/site/login.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/views/site/login.php b/views/site/login.php index 916be9808..bca488c3f 100644 --- a/views/site/login.php +++ b/views/site/login.php @@ -27,9 +27,9 @@ field($model, 'password')->passwordInput() ?> - field($model, 'rememberMe', [ - 'template' => "
{input}
\n
{error}
", - ])->checkbox() ?> + field($model, 'rememberMe')->checkbox([ + 'template' => "
{input} {label}
\n
{error}
", + ]) ?>
From 8b4e2143ff7c3138b14a88fb6c7c03fc302048d1 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Wed, 6 May 2015 16:18:56 +0200 Subject: [PATCH 009/287] updated fxp/composer-asset-plugin version constraint --- .travis.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8a9bd1cfb..72d788d58 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,7 +26,7 @@ cache: install: - travis_retry composer self-update && composer --version - - travis_retry composer global require "fxp/composer-asset-plugin:1.0.0" + - travis_retry composer global require "fxp/composer-asset-plugin:~1.0.0" - export PATH="$HOME/.composer/vendor/bin:$PATH" - travis_retry composer install --dev --prefer-dist --no-interaction # codeception diff --git a/README.md b/README.md index 587e755b8..e5a2d9f76 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ at [getcomposer.org](http://getcomposer.org/doc/00-intro.md#installation-nix). You can then install this project template using the following command: ~~~ -php composer.phar global require "fxp/composer-asset-plugin:1.0.0" +php composer.phar global require "fxp/composer-asset-plugin:~1.0.0" php composer.phar create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic basic ~~~ From a8719e2ef34ded2a7e38f784b4c6ef667d01b157 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Sun, 10 May 2015 01:01:36 +0200 Subject: [PATCH 010/287] Update README.md fixed markdown to display steps correctly. --- tests/README.md | 66 ++++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/tests/README.md b/tests/README.md index 8134fb3a7..ddd70a53a 100644 --- a/tests/README.md +++ b/tests/README.md @@ -6,58 +6,58 @@ After creating the basic application, follow these steps to prepare for the test 1. Install Codeception if it's not yet installed: -``` -composer global require "codeception/codeception=2.0.*" -composer global require "codeception/specify=*" -composer global require "codeception/verify=*" -``` + ``` + composer global require "codeception/codeception=2.0.*" + composer global require "codeception/specify=*" + composer global require "codeception/verify=*" + ``` -If you've never used Composer for global packages run `composer global status`. It should output: + If you've never used Composer for global packages run `composer global status`. It should output: -``` -Changed current directory to -``` + ``` + Changed current directory to + ``` -Then add `/vendor/bin` to you `PATH` environment variable. Now we're able to use `codecept` from command -line globally. + Then add `/vendor/bin` to you `PATH` environment variable. Now we're able to use `codecept` from command + line globally. 2. Install faker extension by running the following from template root directory where `composer.json` is: -``` -composer require --dev yiisoft/yii2-faker:* -``` + ``` + composer require --dev yiisoft/yii2-faker:* + ``` 3. Create `yii2_basic_tests` database and update it by applying migrations: -``` -codeception/bin/yii migrate -``` + ``` + codeception/bin/yii migrate + ``` 4. Build the test suites: -``` -codecept build -``` + ``` + codecept build + ``` 5. In order to be able to run acceptance tests you need to start a webserver. The simplest way is to use PHP built in webserver. In the `web` directory execute the following: -``` -php -S localhost:8080 -``` + ``` + php -S localhost:8080 + ``` 6. Now you can run the tests with the following commands: -``` -# run all available tests -codecept run -# run acceptance tests -codecept run acceptance -# run functional tests -codecept run functional -# run unit tests -codecept run unit -``` + ``` + # run all available tests + codecept run + # run acceptance tests + codecept run acceptance + # run functional tests + codecept run functional + # run unit tests + codecept run unit + ``` Code coverage support --------------------- From 9954bb3b51c6196d23563c0301e46f53ca2c1390 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Sun, 10 May 2015 01:17:26 +0200 Subject: [PATCH 011/287] be more clear about migrations --- tests/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/README.md b/tests/README.md index ddd70a53a..eb2f24b6a 100644 --- a/tests/README.md +++ b/tests/README.md @@ -27,7 +27,7 @@ After creating the basic application, follow these steps to prepare for the test composer require --dev yiisoft/yii2-faker:* ``` -3. Create `yii2_basic_tests` database and update it by applying migrations: +3. Create `yii2_basic_tests` database and update it by applying migrations (you may skip this step if you do not have created any migrations yet): ``` codeception/bin/yii migrate From 6db812e9891200dd834c8bf47db39bddc6c9da74 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Sun, 10 May 2015 18:06:11 -0400 Subject: [PATCH 012/287] 2.0.4 release --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index a5cc0db57..3b5c61697 100644 --- a/composer.json +++ b/composer.json @@ -12,10 +12,10 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "dev", + "minimum-stability": "stable", "require": { "php": ">=5.4.0", - "yiisoft/yii2": "*", + "yiisoft/yii2": ">=2.0.4", "yiisoft/yii2-bootstrap": "*", "yiisoft/yii2-swiftmailer": "*" }, From ff7b5adae524ec52fe0d99d3e1a7ccd4d4edbef1 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Sun, 10 May 2015 18:27:13 -0400 Subject: [PATCH 013/287] prepare for next release --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 3b5c61697..1dabd3bc1 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "stable", + "minimum-stability": "dev", "require": { "php": ">=5.4.0", "yiisoft/yii2": ">=2.0.4", From ff0a3944bfb5edfd38fa8989603778178f186191 Mon Sep 17 00:00:00 2001 From: Evgeniy Tkachenko Date: Wed, 13 May 2015 14:14:06 +0300 Subject: [PATCH 014/287] Update config.php --- tests/codeception/config/config.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/codeception/config/config.php b/tests/codeception/config/config.php index ffc416bc6..d4e1f77ce 100644 --- a/tests/codeception/config/config.php +++ b/tests/codeception/config/config.php @@ -3,6 +3,7 @@ * Application configuration shared by all test types */ return [ + 'language' => 'en-US', 'controllerMap' => [ 'fixture' => [ 'class' => 'yii\faker\FixtureController', From 8a1f362e9f64b54a725e1b4b1ba42d6eae3512b5 Mon Sep 17 00:00:00 2001 From: MaximAL Date: Fri, 5 Jun 2015 17:39:43 +0300 Subject: [PATCH 015/287] Remove redundant `else`s --- controllers/SiteController.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/controllers/SiteController.php b/controllers/SiteController.php index f95994160..4ffba24cb 100644 --- a/controllers/SiteController.php +++ b/controllers/SiteController.php @@ -61,11 +61,10 @@ public function actionLogin() $model = new LoginForm(); if ($model->load(Yii::$app->request->post()) && $model->login()) { return $this->goBack(); - } else { - return $this->render('login', [ - 'model' => $model, - ]); } + return $this->render('login', [ + 'model' => $model, + ]); } public function actionLogout() @@ -82,11 +81,10 @@ public function actionContact() Yii::$app->session->setFlash('contactFormSubmitted'); return $this->refresh(); - } else { - return $this->render('contact', [ - 'model' => $model, - ]); } + return $this->render('contact', [ + 'model' => $model, + ]); } public function actionAbout() From a52ca24ecd14aacb307a5dd011ff2dc6690e0371 Mon Sep 17 00:00:00 2001 From: MaximAL Date: Fri, 5 Jun 2015 17:40:49 +0300 Subject: [PATCH 016/287] Update LoginForm.php --- models/LoginForm.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/models/LoginForm.php b/models/LoginForm.php index 7bd44d402..227168cf6 100644 --- a/models/LoginForm.php +++ b/models/LoginForm.php @@ -58,9 +58,8 @@ public function login() { if ($this->validate()) { return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600*24*30 : 0); - } else { - return false; } + return false; } /** From 0915b934abed59654094d399616f54a40e55ac1e Mon Sep 17 00:00:00 2001 From: MaximAL Date: Fri, 5 Jun 2015 17:41:11 +0300 Subject: [PATCH 017/287] Update ContactForm.php --- models/ContactForm.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/models/ContactForm.php b/models/ContactForm.php index d4052ee93..361b80b39 100644 --- a/models/ContactForm.php +++ b/models/ContactForm.php @@ -57,8 +57,7 @@ public function contact($email) ->send(); return true; - } else { - return false; } + return false; } } From 72c2d75419c95f99ee7cc0a800b45a95ae765622 Mon Sep 17 00:00:00 2001 From: Alex Solomaha Date: Thu, 9 Jul 2015 12:47:20 +0300 Subject: [PATCH 018/287] Views match Yii2 View Code Style close #18 --- views/layouts/main.php | 82 +++++++++++++++++++++-------------------- views/site/about.php | 4 +- views/site/contact.php | 83 ++++++++++++++++++++++++------------------ views/site/error.php | 4 +- views/site/index.php | 2 + views/site/login.php | 23 ++++++------ 6 files changed, 109 insertions(+), 89 deletions(-) diff --git a/views/layouts/main.php b/views/layouts/main.php index d5bba3a04..d5b1b49ee 100644 --- a/views/layouts/main.php +++ b/views/layouts/main.php @@ -1,13 +1,14 @@ beginPage() ?> @@ -21,47 +22,50 @@ head() ?> - beginBody() ?> -
- 'My Company', - 'brandUrl' => Yii::$app->homeUrl, - 'options' => [ - 'class' => 'navbar-inverse navbar-fixed-top', - ], - ]); - echo Nav::widget([ - 'options' => ['class' => 'navbar-nav navbar-right'], - 'items' => [ - ['label' => 'Home', 'url' => ['/site/index']], - ['label' => 'About', 'url' => ['/site/about']], - ['label' => 'Contact', 'url' => ['/site/contact']], - Yii::$app->user->isGuest ? - ['label' => 'Login', 'url' => ['/site/login']] : - ['label' => 'Logout (' . Yii::$app->user->identity->username . ')', - 'url' => ['/site/logout'], - 'linkOptions' => ['data-method' => 'post']], + +
+ 'My Company', + 'brandUrl' => Yii::$app->homeUrl, + 'options' => [ + 'class' => 'navbar-inverse navbar-fixed-top', + ], + ]); + echo Nav::widget([ + 'options' => ['class' => 'navbar-nav navbar-right'], + 'items' => [ + ['label' => 'Home', 'url' => ['/site/index']], + ['label' => 'About', 'url' => ['/site/about']], + ['label' => 'Contact', 'url' => ['/site/contact']], + Yii::$app->user->isGuest ? + ['label' => 'Login', 'url' => ['/site/login']] : + [ + 'label' => 'Logout (' . Yii::$app->user->identity->username . ')', + 'url' => ['/site/logout'], + 'linkOptions' => ['data-method' => 'post'] ], - ]); - NavBar::end(); - ?> + ], + ]); + NavBar::end(); + ?> -
- isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], - ]) ?> - -
+
+ isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], + ]) ?> +
+
+ +
+
+

© My Company

-
-
-

© My Company

-

-
-
+

+
+
endBody() ?> diff --git a/views/site/about.php b/views/site/about.php index 13d85a618..68d5cf3bd 100644 --- a/views/site/about.php +++ b/views/site/about.php @@ -1,7 +1,9 @@ title = 'About'; $this->params['breadcrumbs'][] = $this->title; ?> diff --git a/views/site/contact.php b/views/site/contact.php index e964a3426..22a75bbcc 100644 --- a/views/site/contact.php +++ b/views/site/contact.php @@ -1,12 +1,13 @@ title = 'Contact'; $this->params['breadcrumbs'][] = $this->title; ?> @@ -15,43 +16,53 @@ session->hasFlash('contactFormSubmitted')): ?> -
- Thank you for contacting us. We will respond to you as soon as possible. -
- -

- Note that if you turn on the Yii debugger, you should be able - to view the mail message on the mail panel of the debugger. - mailer->useFileTransport): ?> - Because the application is in development mode, the email is not sent but saved as - a file under mailer->fileTransportPath) ?>. - Please configure the useFileTransport property of the mail - application component to be false to enable email sending. - -

+
+ Thank you for contacting us. We will respond to you as soon as possible. +
+ +

+ Note that if you turn on the Yii debugger, you should be able + to view the mail message on the mail panel of the debugger. + mailer->useFileTransport): ?> + Because the application is in development mode, the email is not sent but saved as + a file under mailer->fileTransportPath) ?>. + Please configure the useFileTransport property of the mail + application component to be false to enable email sending. + +

-

- If you have business inquiries or other questions, please fill out the following form to contact us. Thank you. -

- -
-
- 'contact-form']); ?> - field($model, 'name') ?> - field($model, 'email') ?> - field($model, 'subject') ?> - field($model, 'body')->textArea(['rows' => 6]) ?> - field($model, 'verifyCode')->widget(Captcha::className(), [ - 'template' => '
{image}
{input}
', - ]) ?> -
- 'btn btn-primary', 'name' => 'contact-button']) ?> -
- +

+ If you have business inquiries or other questions, please fill out the following form to contact us. + Thank you. +

+ +
+
+ + 'contact-form']); ?> + + field($model, 'name') ?> + + field($model, 'email') ?> + + field($model, 'subject') ?> + + field($model, 'body')->textArea(['rows' => 6]) ?> + + field($model, 'verifyCode')->widget(Captcha::className(), [ + 'template' => '
{image}
{input}
', + ]) ?> + +
+ 'btn btn-primary', 'name' => 'contact-button']) ?> +
+ + + +
-
diff --git a/views/site/error.php b/views/site/error.php index b9812c488..0ba257465 100644 --- a/views/site/error.php +++ b/views/site/error.php @@ -1,12 +1,12 @@ title = $name; ?>
diff --git a/views/site/index.php b/views/site/index.php index a00ee4da6..f78061088 100644 --- a/views/site/index.php +++ b/views/site/index.php @@ -1,5 +1,7 @@ title = 'My Yii Application'; ?>
diff --git a/views/site/login.php b/views/site/login.php index bca488c3f..059ef8048 100644 --- a/views/site/login.php +++ b/views/site/login.php @@ -1,11 +1,12 @@ title = 'Login'; $this->params['breadcrumbs'][] = $this->title; ?> @@ -23,19 +24,19 @@ ], ]); ?> - field($model, 'username') ?> + field($model, 'username') ?> - field($model, 'password')->passwordInput() ?> + field($model, 'password')->passwordInput() ?> - field($model, 'rememberMe')->checkbox([ - 'template' => "
{input} {label}
\n
{error}
", - ]) ?> + field($model, 'rememberMe')->checkbox([ + 'template' => "
{input} {label}
\n
{error}
", + ]) ?> -
-
- 'btn btn-primary', 'name' => 'login-button']) ?> +
+
+ 'btn btn-primary', 'name' => 'login-button']) ?> +
-
From 757f5dc6bddedaa848c4f183eaccf6a72b95f181 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Sat, 11 Jul 2015 14:21:16 +0200 Subject: [PATCH 019/287] bump yii version for security fix --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 1dabd3bc1..4ad378784 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ "minimum-stability": "dev", "require": { "php": ">=5.4.0", - "yiisoft/yii2": ">=2.0.4", + "yiisoft/yii2": ">=2.0.5", "yiisoft/yii2-bootstrap": "*", "yiisoft/yii2-swiftmailer": "*" }, From 734f8b419d3fa6c0685355450a58d534fdafb4ff Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Sat, 11 Jul 2015 18:05:41 +0200 Subject: [PATCH 020/287] removed duplicate declares these are now defined automatically by console application if needed. see https://github.com/yiisoft/yii2/issues/6853 --- tests/codeception/bin/_bootstrap.php | 4 ---- yii | 4 ---- 2 files changed, 8 deletions(-) diff --git a/tests/codeception/bin/_bootstrap.php b/tests/codeception/bin/_bootstrap.php index c923193a3..bbadc36ef 100644 --- a/tests/codeception/bin/_bootstrap.php +++ b/tests/codeception/bin/_bootstrap.php @@ -2,10 +2,6 @@ defined('YII_DEBUG') or define('YII_DEBUG', true); defined('YII_ENV') or define('YII_ENV', 'test'); -// fcgi doesn't have STDIN and STDOUT defined by default -defined('STDIN') or define('STDIN', fopen('php://stdin', 'r')); -defined('STDOUT') or define('STDOUT', fopen('php://stdout', 'w')); - defined('YII_APP_BASE_PATH') or define('YII_APP_BASE_PATH', dirname(dirname(dirname(__DIR__)))); require(YII_APP_BASE_PATH . '/vendor/autoload.php'); diff --git a/yii b/yii index b032ebdbc..43aa26056 100755 --- a/yii +++ b/yii @@ -10,10 +10,6 @@ defined('YII_DEBUG') or define('YII_DEBUG', true); -// fcgi doesn't have STDIN and STDOUT defined by default -defined('STDIN') or define('STDIN', fopen('php://stdin', 'r')); -defined('STDOUT') or define('STDOUT', fopen('php://stdout', 'w')); - require(__DIR__ . '/vendor/autoload.php'); require(__DIR__ . '/vendor/yiisoft/yii2/Yii.php'); From 73ede01ebd2d4459d62de54923b1016ece7cbb1d Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Tue, 21 Jul 2015 00:57:16 +0300 Subject: [PATCH 021/287] More novice friendly config for gii/debug --- config/web.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/config/web.php b/config/web.php index 1632a5aab..fd03861d7 100644 --- a/config/web.php +++ b/config/web.php @@ -45,10 +45,14 @@ if (YII_ENV_DEV) { // configuration adjustments for 'dev' environment $config['bootstrap'][] = 'debug'; - $config['modules']['debug'] = 'yii\debug\Module'; + $config['modules']['debug'] = [ + 'class' => 'yii\debug\Module', + ]; $config['bootstrap'][] = 'gii'; - $config['modules']['gii'] = 'yii\gii\Module'; + $config['modules']['gii'] = [ + 'class' => 'yii\gii\Module', + ]; } return $config; From a418720887ea4220a8415bab443d22e51c168cad Mon Sep 17 00:00:00 2001 From: MaximAL Date: Tue, 28 Jul 2015 18:45:49 +0300 Subject: [PATCH 022/287] Add `cookieValidationKey` setting to the `Install from an Archive File` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without this, basic application doesn’t work. --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index e5a2d9f76..09426cb81 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,15 @@ INSTALLATION Extract the archive file downloaded from [yiiframework.com](http://www.yiiframework.com/download/) to a directory named `basic` that is directly under the Web root. +Set cookie validation key in `config/web.php` file to some random secret string: + +```php +'request' => [ + // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation + 'cookieValidationKey' => '', +], +``` + You can then access the application through the following URL: ~~~ From 5598a50160cb133ea1c90b2bd807539275f3aab8 Mon Sep 17 00:00:00 2001 From: alcaneo Date: Tue, 4 Aug 2015 10:18:35 +0200 Subject: [PATCH 023/287] Add step to setup config file path in c3.php Hi, I've been struggling in making remote code coverage work and I finally figured out that the config file path was wrong. I haven't seen any documentation telling to update that path (weird). Furthermore, it is kind of impossible to debug as it generates a corrupted tar file (because of the error generated by the wrong config file path probably) that ends up by having an non-related error message (like "unable to decompress gzipped phar archive"). There is another way to do it, by setting the env var HTTP_X_CODECEPTION_CODECOVERAGE_CONFIG but, even though I don't like changing manually c3.php, I still prefer that than using env var as it wouldn't be linked anymore with your project but with your environment (that can be shared with other projects) settings. And I don't know if it would be possible that codeception set this var (as it actually knows the path) to make it available to c3.php, in fact I haven't seen anything setting this var up in codeception code. Cheers, Nico --- tests/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/README.md b/tests/README.md index eb2f24b6a..266bcf929 100644 --- a/tests/README.md +++ b/tests/README.md @@ -90,6 +90,8 @@ from codeception site. 3. include `c3.php` file in your `index-test.php` file before application run, so it can catch needed requests. +4. edit `c3.php` to update config file path (~ line 55) with `$config_file = realpath(__DIR__ . '../tests/codeception.yml');` + Configuration options that are used by remote code coverage: - c3_url: url pointing to entry script that includes `c3.php` file, so `Codeception` will be able to produce code coverage; From e01b9d1cbdff51c1edc69bbbd564d083cc37f91d Mon Sep 17 00:00:00 2001 From: alcaneo Date: Tue, 4 Aug 2015 10:49:22 +0200 Subject: [PATCH 024/287] Missing directory separator in config file path Ugly typo, my bad sorry --- tests/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/README.md b/tests/README.md index 266bcf929..2e1b1aedb 100644 --- a/tests/README.md +++ b/tests/README.md @@ -90,7 +90,7 @@ from codeception site. 3. include `c3.php` file in your `index-test.php` file before application run, so it can catch needed requests. -4. edit `c3.php` to update config file path (~ line 55) with `$config_file = realpath(__DIR__ . '../tests/codeception.yml');` +4. edit `c3.php` to update config file path (~ line 55) with `$config_file = realpath(__DIR__ . '/../tests/codeception.yml');` Configuration options that are used by remote code coverage: From bea667efdcbc4a861f888394cba48b79ad5e51f2 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Thu, 6 Aug 2015 00:21:54 +0200 Subject: [PATCH 025/287] updated tests readme close #4 --- tests/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/README.md b/tests/README.md index 2e1b1aedb..a34f68bb9 100644 --- a/tests/README.md +++ b/tests/README.md @@ -33,6 +33,9 @@ After creating the basic application, follow these steps to prepare for the test codeception/bin/yii migrate ``` + The command needs to be run in the `tests` directory. + The database configuration can be found at `tests/codeception/config/config.php`. + 4. Build the test suites: ``` From 3159d797b754d99c5d8adf8a492ba7522b467ddd Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Thu, 6 Aug 2015 00:23:55 +0200 Subject: [PATCH 026/287] prepare for release 2.0.6 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 4ad378784..1631da65c 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "dev", + "minimum-stability": "stable", "require": { "php": ">=5.4.0", "yiisoft/yii2": ">=2.0.5", From 698c3b849ecca98f43ab30db8f0d1970f21f81af Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Thu, 6 Aug 2015 00:25:54 +0200 Subject: [PATCH 027/287] prepare for next release --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 1631da65c..4ad378784 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "stable", + "minimum-stability": "dev", "require": { "php": ">=5.4.0", "yiisoft/yii2": ">=2.0.5", From 4cedb4db03e1cbdef80f66a64d2b3df1788ad265 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Tue, 8 Sep 2015 01:33:03 +0300 Subject: [PATCH 028/287] Added commented urlManager configuration example to config file --- config/web.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/config/web.php b/config/web.php index fd03861d7..90a82876b 100644 --- a/config/web.php +++ b/config/web.php @@ -38,6 +38,14 @@ ], ], 'db' => require(__DIR__ . '/db.php'), + /* + 'urlManager' => [ + 'enablePrettyUrl' => true, + 'showScriptName' => false, + 'rules' => [ + ], + ], + */ ], 'params' => $params, ]; From f60f7647c57d7ec535812c77fe34cc7b9020c403 Mon Sep 17 00:00:00 2001 From: Daniel Gomez Pan Date: Tue, 8 Sep 2015 23:18:39 +0200 Subject: [PATCH 029/287] remove gii module in production --- config/console.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/config/console.php b/config/console.php index 31ed9c720..e5315b913 100644 --- a/config/console.php +++ b/config/console.php @@ -5,14 +5,11 @@ $params = require(__DIR__ . '/params.php'); $db = require(__DIR__ . '/db.php'); -return [ +$config = [ 'id' => 'basic-console', 'basePath' => dirname(__DIR__), - 'bootstrap' => ['log', 'gii'], + 'bootstrap' => ['log'], 'controllerNamespace' => 'app\commands', - 'modules' => [ - 'gii' => 'yii\gii\Module', - ], 'components' => [ 'cache' => [ 'class' => 'yii\caching\FileCache', @@ -29,3 +26,11 @@ ], 'params' => $params, ]; + +if (YII_ENV_DEV) { + // configuration adjustments for 'dev' environment + $config['bootstrap'][] = 'gii'; + $config['modules']['gii'] = [ + 'class' => 'yii\gii\Module', + ]; +} From 23a48e8d2300b92d49010ca0662a803fc3e98ad2 Mon Sep 17 00:00:00 2001 From: Anatoly Garkusha Date: Fri, 11 Sep 2015 16:16:28 +0300 Subject: [PATCH 030/287] Modify config/console.php add return $config --- config/console.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/console.php b/config/console.php index e5315b913..7c810de99 100644 --- a/config/console.php +++ b/config/console.php @@ -34,3 +34,5 @@ 'class' => 'yii\gii\Module', ]; } + +return $config; From 1dd087dbf10fb7b1b67a5932a395039fee4c17ed Mon Sep 17 00:00:00 2001 From: andreybolonin Date: Fri, 25 Sep 2015 14:54:10 +0300 Subject: [PATCH 031/287] OPcache checking less php 5.5 --- requirements.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/requirements.php b/requirements.php index ee6b2cb53..ee3184f72 100644 --- a/requirements.php +++ b/requirements.php @@ -85,12 +85,6 @@ 'by' => 'MemCache', 'memo' => extension_loaded('memcached') ? 'To use memcached set MemCache::useMemcached to true.' : '' ), - array( - 'name' => 'APC extension', - 'mandatory' => false, - 'condition' => extension_loaded('apc'), - 'by' => 'ApcCache', - ), // CAPTCHA: array( 'name' => 'GD PHP extension with FreeType support', @@ -124,9 +118,20 @@ 'phpSmtp' => array( 'name' => 'PHP mail SMTP', 'mandatory' => false, - 'condition' => strlen(ini_get('SMTP'))>0, + 'condition' => strlen(ini_get('SMTP')) > 0, 'by' => 'Email sending', 'memo' => 'PHP mail SMTP server required', ), ); + +// OPcache check +if (!version_compare(phpversion(), '5.5', '>=')) { + $requirements[] = array( + 'name' => 'APC extension', + 'mandatory' => false, + 'condition' => extension_loaded('apc'), + 'by' => 'ApcCache', + ); +} + $requirementsChecker->checkYii()->check($requirements)->render(); From f68cd5d1f5b2931c4e372ef77f46af891bde8b01 Mon Sep 17 00:00:00 2001 From: Daniel Gomez Pan Date: Sun, 27 Sep 2015 22:24:43 +0200 Subject: [PATCH 032/287] update composer-asset-plugin --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 09426cb81..9a1a4b317 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ at [getcomposer.org](http://getcomposer.org/doc/00-intro.md#installation-nix). You can then install this project template using the following command: ~~~ -php composer.phar global require "fxp/composer-asset-plugin:~1.0.0" +php composer.phar global require "fxp/composer-asset-plugin:~1.0.3" php composer.phar create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic basic ~~~ From 0bfc5f9af50c0ed081318e3fb4cde8f79a6f02e9 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Wed, 21 Oct 2015 01:05:51 +0300 Subject: [PATCH 033/287] Allow logout when JavaScript is disabled --- views/layouts/main.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/views/layouts/main.php b/views/layouts/main.php index d5b1b49ee..b0f613de1 100644 --- a/views/layouts/main.php +++ b/views/layouts/main.php @@ -39,13 +39,18 @@ ['label' => 'Home', 'url' => ['/site/index']], ['label' => 'About', 'url' => ['/site/about']], ['label' => 'Contact', 'url' => ['/site/contact']], - Yii::$app->user->isGuest ? - ['label' => 'Login', 'url' => ['/site/login']] : - [ - 'label' => 'Logout (' . Yii::$app->user->identity->username . ')', - 'url' => ['/site/logout'], - 'linkOptions' => ['data-method' => 'post'] - ], + Yii::$app->user->isGuest ? ( + ['label' => 'Login', 'url' => ['/site/login']] + ) : ( + '
  • ' + . Html::beginForm(['/site/logout'], 'post') + . Html::submitButton( + 'Logout (' . Yii::$app->user->identity->username . ')', + ['class' => 'btn btn-link'] + ) + . Html::endForm() + . '
  • ' + ) ], ]); NavBar::end(); From 4e8ed67326ceb00b78e2f1e8c92ec0140dcbf27e Mon Sep 17 00:00:00 2001 From: Yasser Hassan Date: Wed, 21 Oct 2015 03:07:07 +0200 Subject: [PATCH 034/287] Modified default @tests value and updated READMEs. --- README.md | 7 ++++--- config/console.php | 9 ++++++++- tests/README.md | 11 +++++++++++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9a1a4b317..d658d52fd 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,7 @@ return [ ]; ``` -**NOTE:** Yii won't create the database for you, this has to be done manually before you can access it. - -Also check and edit the other files in the `config/` directory to customize your application. +**NOTES:** +- Yii won't create the database for you, this has to be done manually before you can access it. +- Check and edit the other files in the `config/` directory to customize your application as required. +- Refer to the README in the `tests` direcotry for information specific to basic application tests. diff --git a/config/console.php b/config/console.php index 7c810de99..7306e2764 100644 --- a/config/console.php +++ b/config/console.php @@ -1,6 +1,6 @@ $db, ], 'params' => $params, + /* + 'controllerMap' => [ + 'fixture' => [ // Fixture generation command line. + 'class' => 'yii\faker\FixtureController', + ], + ], + */ ]; if (YII_ENV_DEV) { diff --git a/tests/README.md b/tests/README.md index a34f68bb9..15cb0b8f6 100644 --- a/tests/README.md +++ b/tests/README.md @@ -62,6 +62,17 @@ webserver. In the `web` directory execute the following: codecept run unit ``` +Fixtures Default Configuration +------------------------------ +The `fixture` commands refer to the following `ActiveFixture` configuration by default: + +- Fixtures path: `@tests/unit/fixtures` +- Fixtures data path: `@tests/unit/fixtures/data` +- Template files path: `@tests/unit/templates/fixtures` +- Namespace: `tests\unit\fixtures` + +Where `@tests` refers to `@app/tests/codeception`. + Code coverage support --------------------- From b4f23d82f553737a0afe9de3e8b1b10751448527 Mon Sep 17 00:00:00 2001 From: Jason McCallister Date: Wed, 21 Oct 2015 18:06:24 -0700 Subject: [PATCH 035/287] Update the command for Faker Updates the syntax for the command to composer require yii2-faker. --- tests/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/README.md b/tests/README.md index 15cb0b8f6..fd80fe55c 100644 --- a/tests/README.md +++ b/tests/README.md @@ -24,7 +24,7 @@ After creating the basic application, follow these steps to prepare for the test 2. Install faker extension by running the following from template root directory where `composer.json` is: ``` - composer require --dev yiisoft/yii2-faker:* + composer require --dev "yiisoft/yii2-faker:*" ``` 3. Create `yii2_basic_tests` database and update it by applying migrations (you may skip this step if you do not have created any migrations yet): From edd5c574c8e4a6b70e152f036af3dadae6b53a19 Mon Sep 17 00:00:00 2001 From: Jani Mikkonen Date: Thu, 12 Nov 2015 14:06:30 +0200 Subject: [PATCH 036/287] Update travis composer-asset-plugin --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 72d788d58..cb7617b3c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,7 +26,7 @@ cache: install: - travis_retry composer self-update && composer --version - - travis_retry composer global require "fxp/composer-asset-plugin:~1.0.0" + - travis_retry composer global require "fxp/composer-asset-plugin:~1.1.0" - export PATH="$HOME/.composer/vendor/bin:$PATH" - travis_retry composer install --dev --prefer-dist --no-interaction # codeception From 1c7ac9d07a807b7304f6202977c77cab188a52f6 Mon Sep 17 00:00:00 2001 From: Jani Mikkonen Date: Thu, 12 Nov 2015 14:08:02 +0200 Subject: [PATCH 037/287] Update docs composer-asset-plugin [skip ci] --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d658d52fd..2a413917b 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ at [getcomposer.org](http://getcomposer.org/doc/00-intro.md#installation-nix). You can then install this project template using the following command: ~~~ -php composer.phar global require "fxp/composer-asset-plugin:~1.0.3" +php composer.phar global require "fxp/composer-asset-plugin:~1.1.0" php composer.phar create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic basic ~~~ From fd77e14939bcf4de36df6d1afccb049f9caa0af1 Mon Sep 17 00:00:00 2001 From: niks999 Date: Sun, 29 Nov 2015 12:33:37 +0530 Subject: [PATCH 038/287] Fix typo in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2a413917b..f8ce641ed 100644 --- a/README.md +++ b/README.md @@ -99,4 +99,4 @@ return [ **NOTES:** - Yii won't create the database for you, this has to be done manually before you can access it. - Check and edit the other files in the `config/` directory to customize your application as required. -- Refer to the README in the `tests` direcotry for information specific to basic application tests. +- Refer to the README in the `tests` directory for information specific to basic application tests. From 7cf2418d88aeb77a7facdd0766eafadb0deecd8f Mon Sep 17 00:00:00 2001 From: MaximAL Date: Tue, 1 Dec 2015 19:58:38 +0300 Subject: [PATCH 039/287] Autofocus on username field Useful UX improvement --- views/site/login.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/site/login.php b/views/site/login.php index 059ef8048..559be64f9 100644 --- a/views/site/login.php +++ b/views/site/login.php @@ -24,7 +24,7 @@ ], ]); ?> - field($model, 'username') ?> + field($model, 'username')->textInput(['autofocus' => 'autofocus']) ?> field($model, 'password')->passwordInput() ?> From 4b2e0713e3ba282f9c992e157953147ba7d821c2 Mon Sep 17 00:00:00 2001 From: MaximAL Date: Tue, 1 Dec 2015 20:11:46 +0300 Subject: [PATCH 040/287] HTML5 shorthand for attribute value --- views/site/login.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/site/login.php b/views/site/login.php index 559be64f9..498f46fce 100644 --- a/views/site/login.php +++ b/views/site/login.php @@ -24,7 +24,7 @@ ], ]); ?> - field($model, 'username')->textInput(['autofocus' => 'autofocus']) ?> + field($model, 'username')->textInput(['autofocus' => true]) ?> field($model, 'password')->passwordInput() ?> From 3527b6712c6b2a93c6f12f0673ec14cd14f3b7ed Mon Sep 17 00:00:00 2001 From: MaximAL Date: Tue, 1 Dec 2015 20:16:24 +0300 Subject: [PATCH 041/287] Update contact.php --- views/site/contact.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/site/contact.php b/views/site/contact.php index 22a75bbcc..b98840918 100644 --- a/views/site/contact.php +++ b/views/site/contact.php @@ -43,7 +43,7 @@ 'contact-form']); ?> - field($model, 'name') ?> + field($model, 'name')->textInput(['autofocus' => true]) ?> field($model, 'email') ?> From ce4ad9c851a89cc9fcee9375d4429419d4f206ce Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Wed, 2 Dec 2015 01:12:00 +0100 Subject: [PATCH 042/287] Added missing environment definition in console fixes https://github.com/yiisoft/yii2/issues/10300 --- yii | 1 + 1 file changed, 1 insertion(+) diff --git a/yii b/yii index 43aa26056..fc7090f77 100755 --- a/yii +++ b/yii @@ -9,6 +9,7 @@ */ defined('YII_DEBUG') or define('YII_DEBUG', true); +defined('YII_ENV') or define('YII_ENV', 'dev'); require(__DIR__ . '/vendor/autoload.php'); require(__DIR__ . '/vendor/yiisoft/yii2/Yii.php'); From ad3e23a27a36acff551e4f100fb8f8efbe2f08f2 Mon Sep 17 00:00:00 2001 From: Daniel Gomez Pan Date: Sat, 16 Jan 2016 17:53:38 +0200 Subject: [PATCH 043/287] Updated travis.yml to run on PHP7 --- .travis.yml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index cb7617b3c..7ff498f3c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,16 +5,7 @@ php: - 5.5 - 5.6 - 7.0 -# - hhvm -# - hhvm-nightly - -# run build against hhvm but allow them to fail -# http://docs.travis-ci.com/user/build-configuration/#Rows-That-are-Allowed-To-Fail -matrix: - fast_finish: true - allow_failures: -# - php: hhvm-nightly - - php: 7.0 + - hhvm # faster builds on new travis setup not using sudo sudo: false From 7f7fcb61204f56da71809190137da270578ab0bc Mon Sep 17 00:00:00 2001 From: SilverFire - Dmitry Naumenko Date: Sat, 16 Jan 2016 19:08:23 +0200 Subject: [PATCH 044/287] Updated travis.yml commented HHVM --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7ff498f3c..0d2db1c64 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ php: - 5.5 - 5.6 - 7.0 - - hhvm +# - hhvm # faster builds on new travis setup not using sudo sudo: false From 5eaf2dc07904a0a1ccf23faadf31729345fca919 Mon Sep 17 00:00:00 2001 From: SilverFire - Dmitry Naumenko Date: Sat, 16 Jan 2016 19:11:06 +0200 Subject: [PATCH 045/287] Updated travis.yml fxp-plugin updated to 1.1.1 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0d2db1c64..24b5d54ae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ cache: install: - travis_retry composer self-update && composer --version - - travis_retry composer global require "fxp/composer-asset-plugin:~1.1.0" + - travis_retry composer global require "fxp/composer-asset-plugin:~1.1.1" - export PATH="$HOME/.composer/vendor/bin:$PATH" - travis_retry composer install --dev --prefer-dist --no-interaction # codeception From aa6c28ed1352fd9736cbe11aafc7ff045479bba3 Mon Sep 17 00:00:00 2001 From: Daniel Gomez Pan Date: Sun, 17 Jan 2016 19:24:05 +0100 Subject: [PATCH 046/287] Update composer-asset-plugin --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f8ce641ed..598f9637b 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ at [getcomposer.org](http://getcomposer.org/doc/00-intro.md#installation-nix). You can then install this project template using the following command: ~~~ -php composer.phar global require "fxp/composer-asset-plugin:~1.1.0" +php composer.phar global require "fxp/composer-asset-plugin:~1.1.1" php composer.phar create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic basic ~~~ From df2a935b329df2596f325736e321a5cd518c1935 Mon Sep 17 00:00:00 2001 From: Edo Freriks Date: Mon, 1 Feb 2016 00:39:43 +0100 Subject: [PATCH 047/287] #47, Typo fix address tests --- tests/codeception/acceptance/ContactCept.php | 2 +- tests/codeception/functional/ContactCept.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/codeception/acceptance/ContactCept.php b/tests/codeception/acceptance/ContactCept.php index b51d1c085..f848443da 100644 --- a/tests/codeception/acceptance/ContactCept.php +++ b/tests/codeception/acceptance/ContactCept.php @@ -35,7 +35,7 @@ if (method_exists($I, 'wait')) { $I->wait(3); // only for selenium } -$I->expectTo('see that email adress is wrong'); +$I->expectTo('see that email address is wrong'); $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'); diff --git a/tests/codeception/functional/ContactCept.php b/tests/codeception/functional/ContactCept.php index 074820a70..b17a7576d 100644 --- a/tests/codeception/functional/ContactCept.php +++ b/tests/codeception/functional/ContactCept.php @@ -29,7 +29,7 @@ 'body' => 'test content', 'verifyCode' => 'testme', ]); -$I->expectTo('see that email adress is wrong'); +$I->expectTo('see that email address is wrong'); $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'); From 940451bc8f264217977dca5ee097035c9426c743 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Sun, 14 Feb 2016 15:56:01 +0100 Subject: [PATCH 048/287] prepare for 2.0.7 release --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 4ad378784..1631da65c 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "dev", + "minimum-stability": "stable", "require": { "php": ">=5.4.0", "yiisoft/yii2": ">=2.0.5", From acb438affb993f51d9712852635c8135239e9e8a Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Sun, 14 Feb 2016 15:56:44 +0100 Subject: [PATCH 049/287] prepare for next release --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 1631da65c..4ad378784 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "stable", + "minimum-stability": "dev", "require": { "php": ">=5.4.0", "yiisoft/yii2": ">=2.0.5", From f002567220b9ce9670f4d7fd71701df17c87a86b Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Wed, 9 Mar 2016 18:47:19 +0300 Subject: [PATCH 050/287] Removed unnecessary slash --- controllers/SiteController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/SiteController.php b/controllers/SiteController.php index 4ffba24cb..df1a0d376 100644 --- a/controllers/SiteController.php +++ b/controllers/SiteController.php @@ -54,7 +54,7 @@ public function actionIndex() public function actionLogin() { - if (!\Yii::$app->user->isGuest) { + if (!Yii::$app->user->isGuest) { return $this->goHome(); } From 27fbea32d82a57f98d56ad1e2f60295e5fdda5a0 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Mon, 21 Mar 2016 22:10:44 +0300 Subject: [PATCH 051/287] Added issue templates --- .gitattributes | 1 + .github/CONTRIBUTING.md | 7 +++++++ .github/ISSUE_TEMPLATE.md | 14 ++++++++++++++ .github/PULL_REQUEST_TEMPLATE.md | 7 +++++++ 4 files changed, 29 insertions(+) create mode 100644 .github/CONTRIBUTING.md create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.gitattributes b/.gitattributes index 6b9d3d398..3e9092c68 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,5 @@ # Ignore all test and documentation for archive +/.github export-ignore /.gitattributes export-ignore /.scrutinizer.yml export-ignore /.travis.yml export-ignore diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 000000000..b0924689b --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,7 @@ +Contributing to Yii2 +==================== + +- [Report an issue](docs/internals/report-an-issue.md) +- [Translate documentation or messages](docs/internals/translation-workflow.md) +- [Give us feedback or start a design discussion](http://www.yiiframework.com/forum/index.php/forum/42-general-discussions-for-yii-20/) +- [Contribute to the core code or fix bugs](docs/internals/git-workflow.md) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 000000000..52ec8692f --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,14 @@ +### What steps will reproduce the problem? + +### What's expected? + +### What do you get instead? + + +### Additional info + +| Q | A +| ---------------- | --- +| Yii vesion | +| PHP version | +| Operating system | diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..968a845de --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,7 @@ +| Q | A +| ------------- | --- +| Is bugfix? | yes/no +| New feature? | yes/no +| Breaks BC? | yes/no +| Tests pass? | yes/no +| Fixed issues | comma-separated list of tickets # fixed by the PR, if any From c97c8c605d7a8b6f8ed1646093f131ca80bd1444 Mon Sep 17 00:00:00 2001 From: Bulat Damdinov Date: Wed, 23 Mar 2016 19:55:38 +0800 Subject: [PATCH 052/287] #51 logout btn --- views/layouts/main.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/layouts/main.php b/views/layouts/main.php index b0f613de1..2974d6d89 100644 --- a/views/layouts/main.php +++ b/views/layouts/main.php @@ -43,7 +43,7 @@ ['label' => 'Login', 'url' => ['/site/login']] ) : ( '
  • ' - . Html::beginForm(['/site/logout'], 'post') + . Html::beginForm(['/site/logout'], 'post', ['class' => 'navbar-form']) . Html::submitButton( 'Logout (' . Yii::$app->user->identity->username . ')', ['class' => 'btn btn-link'] From af67434e7e57b6133219bd1ebfdbaee67c73e0d9 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Thu, 14 Apr 2016 11:45:41 +0300 Subject: [PATCH 053/287] Fixed links in CONTRIBUTING.md --- .github/CONTRIBUTING.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index b0924689b..3d8d32c25 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,7 +1,7 @@ Contributing to Yii2 ==================== -- [Report an issue](docs/internals/report-an-issue.md) -- [Translate documentation or messages](docs/internals/translation-workflow.md) +- [Report an issue](https://github.com/yiisoft/yii2/blob/master/docs/internals/report-an-issue.md) +- [Translate documentation or messages](https://github.com/yiisoft/yii2/blob/master/docs/internals/translation-workflow.md) - [Give us feedback or start a design discussion](http://www.yiiframework.com/forum/index.php/forum/42-general-discussions-for-yii-20/) -- [Contribute to the core code or fix bugs](docs/internals/git-workflow.md) +- [Contribute to the core code or fix bugs](https://github.com/yiisoft/yii2/blob/master/docs/internals/git-workflow.md) From 6962834f3715a5a9a27556ca53f8527ff1737828 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Thu, 28 Apr 2016 18:06:20 +0200 Subject: [PATCH 054/287] release version 2.0.8 --- composer.json | 2 +- models/ContactForm.php | 3 ++- models/LoginForm.php | 3 +++ models/User.php | 5 +++-- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 4ad378784..1631da65c 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "dev", + "minimum-stability": "stable", "require": { "php": ">=5.4.0", "yiisoft/yii2": ">=2.0.5", diff --git a/models/ContactForm.php b/models/ContactForm.php index 361b80b39..37f48b312 100644 --- a/models/ContactForm.php +++ b/models/ContactForm.php @@ -16,6 +16,7 @@ class ContactForm extends Model public $body; public $verifyCode; + /** * @return array the validation rules. */ @@ -43,7 +44,7 @@ public function attributeLabels() /** * Sends an email to the specified email address using the information collected by this model. - * @param string $email the target email address + * @param string $email the target email address * @return boolean whether the model passes validation */ public function contact($email) diff --git a/models/LoginForm.php b/models/LoginForm.php index 227168cf6..7ef5c99b3 100644 --- a/models/LoginForm.php +++ b/models/LoginForm.php @@ -7,6 +7,9 @@ /** * LoginForm is the model behind the login form. + * + * @property User|null $user This property is read-only. + * */ class LoginForm extends Model { diff --git a/models/User.php b/models/User.php index cbfb9fefc..163a64fcd 100644 --- a/models/User.php +++ b/models/User.php @@ -27,6 +27,7 @@ class User extends \yii\base\Object implements \yii\web\IdentityInterface ], ]; + /** * @inheritdoc */ @@ -52,7 +53,7 @@ public static function findIdentityByAccessToken($token, $type = null) /** * Finds user by username * - * @param string $username + * @param string $username * @return static|null */ public static function findByUsername($username) @@ -93,7 +94,7 @@ public function validateAuthKey($authKey) /** * Validates password * - * @param string $password password to validate + * @param string $password password to validate * @return boolean if password provided is valid for current user */ public function validatePassword($password) From 655b5c3502972ebdb701558b0906cf8d524e92c0 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Thu, 28 Apr 2016 18:06:57 +0200 Subject: [PATCH 055/287] prepare for next release --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 1631da65c..4ad378784 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "stable", + "minimum-stability": "dev", "require": { "php": ">=5.4.0", "yiisoft/yii2": ">=2.0.5", From dd0c43247f2a7f45a276be220c98ea8fd81f0d2f Mon Sep 17 00:00:00 2001 From: Bulat Damdinov Date: Tue, 24 May 2016 18:14:58 +0800 Subject: [PATCH 056/287] fixed link for AcceptanceTest Selenuim Webdriver --- tests/codeception/acceptance.suite.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/codeception/acceptance.suite.yml b/tests/codeception/acceptance.suite.yml index 1781b0077..d36d7360b 100644 --- a/tests/codeception/acceptance.suite.yml +++ b/tests/codeception/acceptance.suite.yml @@ -13,7 +13,7 @@ modules: enabled: - PhpBrowser # you can use WebDriver instead of PhpBrowser to test javascript and ajax. -# This will require you to install selenium. See http://codeception.com/docs/04-AcceptanceTests#Selenium +# This will require you to install selenium. See http://codeception.com/docs/03-AcceptanceTests#selenium-webdriver # "restart" option is used by the WebDriver to start each time per test-file new session and cookies, # it is useful if you want to login in your app in each test. # - WebDriver From ddeab345bb178025fcb3931b0be4f3c84b0b74ab Mon Sep 17 00:00:00 2001 From: Kalinin Alexandr Date: Sun, 19 Jun 2016 16:56:22 +0300 Subject: [PATCH 057/287] Update SiteController.php (#61) [skip ci] --- controllers/SiteController.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/controllers/SiteController.php b/controllers/SiteController.php index df1a0d376..36dc9591b 100644 --- a/controllers/SiteController.php +++ b/controllers/SiteController.php @@ -11,6 +11,9 @@ class SiteController extends Controller { + /** + * @inheritdoc + */ public function behaviors() { return [ @@ -34,6 +37,9 @@ public function behaviors() ]; } + /** + * @inheritdoc + */ public function actions() { return [ @@ -47,11 +53,21 @@ public function actions() ]; } + /** + * Displays homepage. + * + * @return string + */ public function actionIndex() { return $this->render('index'); } + /** + * Login action. + * + * @return string + */ public function actionLogin() { if (!Yii::$app->user->isGuest) { @@ -67,6 +83,11 @@ public function actionLogin() ]); } + /** + * Logout action. + * + * @return string + */ public function actionLogout() { Yii::$app->user->logout(); @@ -74,6 +95,11 @@ public function actionLogout() return $this->goHome(); } + /** + * Displays contact page. + * + * @return string + */ public function actionContact() { $model = new ContactForm(); @@ -87,6 +113,11 @@ public function actionContact() ]); } + /** + * Displays about page. + * + * @return string + */ public function actionAbout() { return $this->render('about'); From c200693b05704bbe50ffe88513b62715ea737f1c Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Sat, 2 Jul 2016 19:51:35 +0300 Subject: [PATCH 058/287] Fixes #62: Changed usage of deprecated getMock() to current createMock() --- tests/codeception/unit/models/ContactFormTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/codeception/unit/models/ContactFormTest.php b/tests/codeception/unit/models/ContactFormTest.php index 323482943..9bc36d174 100644 --- a/tests/codeception/unit/models/ContactFormTest.php +++ b/tests/codeception/unit/models/ContactFormTest.php @@ -26,7 +26,7 @@ protected function tearDown() public function testContact() { - $model = $this->getMock('app\models\ContactForm', ['validate']); + $model = $this->createMock('app\models\ContactForm', ['validate']); $model->expects($this->once())->method('validate')->will($this->returnValue(true)); $model->attributes = [ From e6cdaa5a1abc25f619d53a7745de33e645b48359 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Sat, 2 Jul 2016 20:13:40 +0300 Subject: [PATCH 059/287] Fixed test to mock form properly --- tests/codeception/unit/models/ContactFormTest.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/codeception/unit/models/ContactFormTest.php b/tests/codeception/unit/models/ContactFormTest.php index 9bc36d174..7dc4fe433 100644 --- a/tests/codeception/unit/models/ContactFormTest.php +++ b/tests/codeception/unit/models/ContactFormTest.php @@ -2,6 +2,7 @@ namespace tests\codeception\unit\models; +use app\models\ContactForm; use Yii; use yii\codeception\TestCase; use Codeception\Specify; @@ -26,7 +27,10 @@ protected function tearDown() public function testContact() { - $model = $this->createMock('app\models\ContactForm', ['validate']); + /** @var ContactForm $model */ + $model = $this->getMockBuilder('app\models\ContactForm') + ->setMethods(['validate']) + ->getMock(); $model->expects($this->once())->method('validate')->will($this->returnValue(true)); $model->attributes = [ @@ -36,9 +40,8 @@ public function testContact() 'body' => 'body of current message', ]; - $model->contact('admin@example.com'); - - $this->specify('email should be send', function () { + $this->specify('email should be send', function () use ($model) { + expect('ContactForm::contact() should return true', $model->contact('admin@example.com'))->true(); expect('email file should exist', file_exists($this->getMessageFile()))->true(); }); From d579eb6434e070c1ca8820b61371db4d2d1e64f4 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Sat, 2 Jul 2016 20:22:42 +0300 Subject: [PATCH 060/287] Changed php -S to ./yii serve in tests readme --- tests/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/README.md b/tests/README.md index fd80fe55c..4b2519665 100644 --- a/tests/README.md +++ b/tests/README.md @@ -42,11 +42,11 @@ After creating the basic application, follow these steps to prepare for the test codecept build ``` -5. In order to be able to run acceptance tests you need to start a webserver. The simplest way is to use PHP built in -webserver. In the `web` directory execute the following: +5. In order to be able to run acceptance tests you need to start a webserver. The simplest way is to use built-in Yii +command: ``` - php -S localhost:8080 + ./yii serve ``` 6. Now you can run the tests with the following commands: From e0954011ce9ae0227c12e174a58e15ff3503c90d Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Tue, 5 Jul 2016 01:17:16 +0300 Subject: [PATCH 061/287] Added "cd tests" as suggested in https://github.com/yiisoft/yii2-app-basic/issues/63#issuecomment-230354273 --- tests/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/README.md b/tests/README.md index 4b2519665..35142d612 100644 --- a/tests/README.md +++ b/tests/README.md @@ -30,6 +30,7 @@ After creating the basic application, follow these steps to prepare for the test 3. Create `yii2_basic_tests` database and update it by applying migrations (you may skip this step if you do not have created any migrations yet): ``` + cd tests codeception/bin/yii migrate ``` From 6545745e88677afb4637bad127c4926120882e99 Mon Sep 17 00:00:00 2001 From: Mohamed Cherif Bouchelaghem Date: Mon, 11 Jul 2016 13:43:55 +0100 Subject: [PATCH 062/287] configure Codeception::Scpecify to not deep clone properties by default (#57) --- tests/codeception/_bootstrap.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/codeception/_bootstrap.php b/tests/codeception/_bootstrap.php index 755029ef3..f24347fe5 100644 --- a/tests/codeception/_bootstrap.php +++ b/tests/codeception/_bootstrap.php @@ -14,3 +14,10 @@ $_SERVER['SERVER_PORT'] = parse_url(http://github.com/Codeception/Configuration::config()['config']['test_entry_url'], PHP_URL_PORT) ?: '80'; Yii::setAlias('@tests', dirname(__DIR__)); + +/** + * this configure codeception specify to not deep clone objects properties + * it can be configure localy in your tests + * @see https://github.com/Codeception/Specify/tree/master/docs + */ +\Codeception\Specify\Config::setDeepClone(false); From 5319c23281f4543da41f7f5ed72837f597fe9ab4 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Mon, 11 Jul 2016 15:43:39 +0200 Subject: [PATCH 063/287] release version 2.0.9 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 4ad378784..1631da65c 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "dev", + "minimum-stability": "stable", "require": { "php": ">=5.4.0", "yiisoft/yii2": ">=2.0.5", From 548af0eacdd8d000bde121b122d0f36e2c218605 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Mon, 11 Jul 2016 15:43:58 +0200 Subject: [PATCH 064/287] prepare for next release --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 1631da65c..4ad378784 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "stable", + "minimum-stability": "dev", "require": { "php": ">=5.4.0", "yiisoft/yii2": ">=2.0.5", From 71ee8a08a0fbe6856d50075d92a35b10be39ab77 Mon Sep 17 00:00:00 2001 From: Davert Date: Thu, 14 Jul 2016 17:20:08 +0300 Subject: [PATCH 065/287] dependencies should be stable --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 4ad378784..1631da65c 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "dev", + "minimum-stability": "stable", "require": { "php": ">=5.4.0", "yiisoft/yii2": ">=2.0.5", From 75a273eb40535cc3e4ed27211e53ee243bccebaa Mon Sep 17 00:00:00 2001 From: Oleg Kostiushko Date: Thu, 14 Jul 2016 19:19:59 +0300 Subject: [PATCH 066/287] Acceptance test refactoring - Contact form (#2) * directory _support should exists before build with ignore inside * added test for contact page availability * added test for empty contact form submit * added test for submit contact form * remove test contact page * delete old contact page test * test index-test instead index * change stage description --- tests/codeception/_pages/ContactPage.php | 26 --------- tests/codeception/_support/.gitignore | 2 + tests/codeception/acceptance/ContactCept.php | 57 -------------------- tests/codeception/acceptance/ContactCest.php | 33 ++++++++++++ 4 files changed, 35 insertions(+), 83 deletions(-) delete mode 100644 tests/codeception/_pages/ContactPage.php create mode 100644 tests/codeception/_support/.gitignore delete mode 100644 tests/codeception/acceptance/ContactCept.php create mode 100644 tests/codeception/acceptance/ContactCest.php diff --git a/tests/codeception/_pages/ContactPage.php b/tests/codeception/_pages/ContactPage.php deleted file mode 100644 index 5701e2cb4..000000000 --- a/tests/codeception/_pages/ContactPage.php +++ /dev/null @@ -1,26 +0,0 @@ - $value) { - $inputType = $field === 'body' ? 'textarea' : 'input'; - $this->actor->fillField($inputType . '[name="ContactForm[' . $field . ']"]', $value); - } - $this->actor->click('contact-button'); - } -} diff --git a/tests/codeception/_support/.gitignore b/tests/codeception/_support/.gitignore new file mode 100644 index 000000000..c96a04f00 --- /dev/null +++ b/tests/codeception/_support/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/tests/codeception/acceptance/ContactCept.php b/tests/codeception/acceptance/ContactCept.php deleted file mode 100644 index f848443da..000000000 --- a/tests/codeception/acceptance/ContactCept.php +++ /dev/null @@ -1,57 +0,0 @@ -wantTo('ensure that contact works'); - -$contactPage = ContactPage::openBy($I); - -$I->see('Contact', 'h1'); - -$I->amGoingTo('submit contact form with no data'); -$contactPage->submit([]); -if (method_exists($I, 'wait')) { - $I->wait(3); // only for selenium -} -$I->expectTo('see validations errors'); -$I->see('Contact', 'h1'); -$I->see('Name cannot be blank'); -$I->see('Email cannot be blank'); -$I->see('Subject cannot be blank'); -$I->see('Body cannot be blank'); -$I->see('The verification code is incorrect'); - -$I->amGoingTo('submit contact form with not correct email'); -$contactPage->submit([ - 'name' => 'tester', - 'email' => 'tester.email', - 'subject' => 'test subject', - 'body' => 'test content', - 'verifyCode' => 'testme', -]); -if (method_exists($I, 'wait')) { - $I->wait(3); // only for selenium -} -$I->expectTo('see that email address is wrong'); -$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->amGoingTo('submit contact form with correct data'); -$contactPage->submit([ - 'name' => 'tester', - 'email' => 'tester@example.com', - 'subject' => 'test subject', - 'body' => 'test content', - 'verifyCode' => 'testme', -]); -if (method_exists($I, 'wait')) { - $I->wait(3); // only for selenium -} -$I->dontSeeElement('#contact-form'); -$I->see('Thank you for contacting us. We will respond to you as soon as possible.'); diff --git a/tests/codeception/acceptance/ContactCest.php b/tests/codeception/acceptance/ContactCest.php new file mode 100644 index 000000000..0a317ce50 --- /dev/null +++ b/tests/codeception/acceptance/ContactCest.php @@ -0,0 +1,33 @@ +amOnPage('index-test.php?r=site%2Fcontact'); + } + + public function contactPageWorks(AcceptanceTester $I) + { + $I->wantTo('ensure that contact page works'); + $I->see('Contact', 'h1'); + } + + public function contactFormCanBeSubmitted(AcceptanceTester $I) + { + $I->amGoingTo('submit contact form with correct data'); + $I->fillField('#contactform-name', 'tester'); + $I->fillField('#contactform-email', 'tester@example.com'); + $I->fillField('#contactform-subject', 'test subject'); + $I->fillField('#contactform-body', 'test content'); + $I->fillField('#contactform-verifycode', 'testme'); + + $I->click('contact-button'); + + $I->dontSeeElement('#contact-form'); + $I->see('Thank you for contacting us. We will respond to you as soon as possible.'); + } +} From aaee0841e13f46614911e05e83670a60fe2bc1e7 Mon Sep 17 00:00:00 2001 From: Maxim Shcherbakov Date: Thu, 14 Jul 2016 19:20:28 +0300 Subject: [PATCH 067/287] Acceptance tests refactoring (#1) --- .../codeception/_support/AcceptanceTester.php | 26 +++++++++++++ .../codeception/_support/FunctionalTester.php | 26 +++++++++++++ tests/codeception/_support/UnitTester.php | 26 +++++++++++++ .../_support/_generated/.gitignore | 2 + tests/codeception/acceptance.suite.yml | 2 + tests/codeception/acceptance/AboutCept.php | 10 ----- tests/codeception/acceptance/AboutCest.php | 11 ++++++ tests/codeception/acceptance/HomeCept.php | 11 ------ tests/codeception/acceptance/HomeCest.php | 16 ++++++++ tests/codeception/acceptance/LoginCept.php | 37 ------------------- tests/codeception/acceptance/LoginCest.php | 19 ++++++++++ 11 files changed, 128 insertions(+), 58 deletions(-) create mode 100644 tests/codeception/_support/AcceptanceTester.php create mode 100644 tests/codeception/_support/FunctionalTester.php create mode 100644 tests/codeception/_support/UnitTester.php create mode 100644 tests/codeception/_support/_generated/.gitignore delete mode 100644 tests/codeception/acceptance/AboutCept.php create mode 100644 tests/codeception/acceptance/AboutCest.php delete mode 100644 tests/codeception/acceptance/HomeCept.php create mode 100644 tests/codeception/acceptance/HomeCest.php delete mode 100644 tests/codeception/acceptance/LoginCept.php create mode 100644 tests/codeception/acceptance/LoginCest.php diff --git a/tests/codeception/_support/AcceptanceTester.php b/tests/codeception/_support/AcceptanceTester.php new file mode 100644 index 000000000..4c7dcbb6d --- /dev/null +++ b/tests/codeception/_support/AcceptanceTester.php @@ -0,0 +1,26 @@ +wantTo('ensure that about works'); -AboutPage::openBy($I); -$I->see('About', 'h1'); diff --git a/tests/codeception/acceptance/AboutCest.php b/tests/codeception/acceptance/AboutCest.php new file mode 100644 index 000000000..a3cbef66b --- /dev/null +++ b/tests/codeception/acceptance/AboutCest.php @@ -0,0 +1,11 @@ +amOnPage(['site/about']); + $I->amOnPage('index.php?r=site%2Fabout'); + $I->see('About', 'h1'); + } +} diff --git a/tests/codeception/acceptance/HomeCept.php b/tests/codeception/acceptance/HomeCept.php deleted file mode 100644 index 1f9353595..000000000 --- a/tests/codeception/acceptance/HomeCept.php +++ /dev/null @@ -1,11 +0,0 @@ -wantTo('ensure that home page works'); -$I->amOnPage(Yii::$app->homeUrl); -$I->see('My Company'); -$I->seeLink('About'); -$I->click('About'); -$I->see('This is the About page.'); diff --git a/tests/codeception/acceptance/HomeCest.php b/tests/codeception/acceptance/HomeCest.php new file mode 100644 index 000000000..cd7b22436 --- /dev/null +++ b/tests/codeception/acceptance/HomeCest.php @@ -0,0 +1,16 @@ +amOnPage(Yii::$app->homeUrl); + $I->amOnPage('index.php?r=site%2Findex'); + $I->see('My Company'); + + $I->seeLink('About'); + $I->click('About'); + + $I->see('This is the About page.'); + } +} diff --git a/tests/codeception/acceptance/LoginCept.php b/tests/codeception/acceptance/LoginCept.php deleted file mode 100644 index 90d063583..000000000 --- a/tests/codeception/acceptance/LoginCept.php +++ /dev/null @@ -1,37 +0,0 @@ -wantTo('ensure that login works'); - -$loginPage = LoginPage::openBy($I); - -$I->see('Login', 'h1'); - -$I->amGoingTo('try to login with empty credentials'); -$loginPage->login('', ''); -if (method_exists($I, 'wait')) { - $I->wait(3); // only for selenium -} -$I->expectTo('see validations errors'); -$I->see('Username cannot be blank.'); -$I->see('Password cannot be blank.'); - -$I->amGoingTo('try to login with wrong credentials'); -$loginPage->login('admin', 'wrong'); -if (method_exists($I, 'wait')) { - $I->wait(3); // only for selenium -} -$I->expectTo('see validations errors'); -$I->see('Incorrect username or password.'); - -$I->amGoingTo('try to login with correct credentials'); -$loginPage->login('admin', 'admin'); -if (method_exists($I, 'wait')) { - $I->wait(3); // only for selenium -} -$I->expectTo('see user info'); -$I->see('Logout (admin)'); diff --git a/tests/codeception/acceptance/LoginCest.php b/tests/codeception/acceptance/LoginCest.php new file mode 100644 index 000000000..97f39800a --- /dev/null +++ b/tests/codeception/acceptance/LoginCest.php @@ -0,0 +1,19 @@ +amOnPage(['site/login']); + $I->amOnPage('index.php?r=site%2Flogin'); + $I->see('Login', 'h1'); + + $I->amGoingTo('try to login with correct credentials'); + $I->fillField('input[name="LoginForm[username]"]', 'admin'); + $I->fillField('input[name="LoginForm[password]"]', 'admin'); + $I->click('login-button'); + + $I->expectTo('see user info'); + $I->see('Logout (admin)'); + } +} From b1015559e013357b16acd1cdd8ab13eb95015509 Mon Sep 17 00:00:00 2001 From: Davert Date: Thu, 14 Jul 2016 21:03:28 +0300 Subject: [PATCH 068/287] refactoring --- .gitignore | 2 + tests/codeception.yml => codeception.yml | 17 +- composer.json | 2 + composer.lock | 1025 +++++++ config/test.php | 35 + config/web.php | 2 +- tests/_bootstrap.php | 10 + tests/{codeception => }/_output/.gitignore | 0 tests/{codeception => }/_pages/AboutPage.php | 0 tests/_pages/ContactPage.php | 26 + tests/{codeception => }/_pages/LoginPage.php | 0 tests/_support/AcceptanceTester.php | 26 + tests/_support/FunctionalTester.php | 26 + tests/_support/UnitTester.php | 26 + .../_generated/AcceptanceTesterActions.php | 2247 ++++++++++++++ .../_generated/FunctionalTesterActions.php | 2691 +++++++++++++++++ .../_support/_generated/UnitTesterActions.php | 576 ++++ tests/acceptance.suite.yml.example | 27 + tests/acceptance/AboutCept.php | 10 + tests/acceptance/ContactCept.php | 57 + tests/acceptance/HomeCept.php | 11 + tests/acceptance/LoginCept.php | 37 + .../acceptance/_bootstrap.php | 0 tests/{codeception => }/bin/_bootstrap.php | 0 tests/{codeception => }/bin/yii | 0 tests/{codeception => }/bin/yii.bat | 0 tests/codeception/_bootstrap.php | 23 - tests/codeception/config/config.php | 26 - tests/codeception/functional/_bootstrap.php | 2 - tests/{codeception => }/config/acceptance.php | 2 +- tests/{codeception => }/config/functional.php | 5 +- tests/{codeception => }/config/unit.php | 2 +- tests/{codeception => }/fixtures/.gitignore | 0 tests/{codeception => }/functional.suite.yml | 6 +- .../functional/AboutCept.php | 0 .../functional/ContactCept.php | 0 .../{codeception => }/functional/HomeCept.php | 0 .../functional/LoginCept.php | 0 tests/functional/_bootstrap.php | 1 + tests/{codeception => }/templates/.gitignore | 0 tests/{codeception => }/unit.suite.yml | 6 + tests/{codeception => }/unit/_bootstrap.php | 0 .../{codeception => }/unit/fixtures/.gitkeep | 0 .../unit/fixtures/data/.gitkeep | 0 .../unit/models/ContactFormTest.php | 0 .../unit/models/LoginFormTest.php | 0 .../unit/models/UserTest.php | 0 .../unit/templates/fixtures/.gitkeep | 0 48 files changed, 6853 insertions(+), 73 deletions(-) rename tests/codeception.yml => codeception.yml (60%) create mode 100644 composer.lock create mode 100644 config/test.php create mode 100644 tests/_bootstrap.php rename tests/{codeception => }/_output/.gitignore (100%) rename tests/{codeception => }/_pages/AboutPage.php (100%) create mode 100644 tests/_pages/ContactPage.php rename tests/{codeception => }/_pages/LoginPage.php (100%) create mode 100644 tests/_support/AcceptanceTester.php create mode 100644 tests/_support/FunctionalTester.php create mode 100644 tests/_support/UnitTester.php create mode 100644 tests/_support/_generated/AcceptanceTesterActions.php create mode 100644 tests/_support/_generated/FunctionalTesterActions.php create mode 100644 tests/_support/_generated/UnitTesterActions.php create mode 100644 tests/acceptance.suite.yml.example create mode 100644 tests/acceptance/AboutCept.php create mode 100644 tests/acceptance/ContactCept.php create mode 100644 tests/acceptance/HomeCept.php create mode 100644 tests/acceptance/LoginCept.php rename tests/{codeception => }/acceptance/_bootstrap.php (100%) rename tests/{codeception => }/bin/_bootstrap.php (100%) rename tests/{codeception => }/bin/yii (100%) rename tests/{codeception => }/bin/yii.bat (100%) delete mode 100644 tests/codeception/_bootstrap.php delete mode 100644 tests/codeception/config/config.php delete mode 100644 tests/codeception/functional/_bootstrap.php rename tests/{codeception => }/config/acceptance.php (75%) rename tests/{codeception => }/config/functional.php (79%) rename tests/{codeception => }/config/unit.php (74%) rename tests/{codeception => }/fixtures/.gitignore (100%) rename tests/{codeception => }/functional.suite.yml (76%) rename tests/{codeception => }/functional/AboutCept.php (100%) rename tests/{codeception => }/functional/ContactCept.php (100%) rename tests/{codeception => }/functional/HomeCept.php (100%) rename tests/{codeception => }/functional/LoginCept.php (100%) create mode 100644 tests/functional/_bootstrap.php rename tests/{codeception => }/templates/.gitignore (100%) rename tests/{codeception => }/unit.suite.yml (56%) rename tests/{codeception => }/unit/_bootstrap.php (100%) rename tests/{codeception => }/unit/fixtures/.gitkeep (100%) rename tests/{codeception => }/unit/fixtures/data/.gitkeep (100%) rename tests/{codeception => }/unit/models/ContactFormTest.php (100%) rename tests/{codeception => }/unit/models/LoginFormTest.php (100%) rename tests/{codeception => }/unit/models/UserTest.php (100%) rename tests/{codeception => }/unit/templates/fixtures/.gitkeep (100%) diff --git a/.gitignore b/.gitignore index 45bf7bf41..9af11e24d 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,5 @@ composer.phar phpunit.phar # local phpunit config /phpunit.xml + +tests/_output/* \ No newline at end of file diff --git a/tests/codeception.yml b/codeception.yml similarity index 60% rename from tests/codeception.yml rename to codeception.yml index b71ba31c1..d5d1aaf24 100644 --- a/tests/codeception.yml +++ b/codeception.yml @@ -1,4 +1,5 @@ actor: Tester +# To enable code coverage: #coverage: # #c3_url: http://localhost:8080/index-test.php/ # enabled: true @@ -20,17 +21,11 @@ actor: Tester # - ../web/* # - ../tests/* paths: - tests: codeception - log: codeception/_output - data: codeception/_data - helpers: codeception/_support + tests: tests + log: tests/_output + data: tests/_data + helpers: tests/_support settings: bootstrap: _bootstrap.php - suite_class: \PHPUnit_Framework_TestSuite memory_limit: 1024M - log: true - colors: true -config: - # the entry script URL (with host info) for functional and acceptance tests - # PLEASE ADJUST IT TO THE ACTUAL ENTRY SCRIPT URL - test_entry_url: http://localhost:8080/index-test.php \ No newline at end of file + colors: true \ No newline at end of file diff --git a/composer.json b/composer.json index 1631da65c..137ee77a6 100644 --- a/composer.json +++ b/composer.json @@ -21,6 +21,8 @@ }, "require-dev": { "yiisoft/yii2-codeception": "*", + "codeception/specify": "*", + "codeception/verify": "*", "yiisoft/yii2-debug": "*", "yiisoft/yii2-gii": "*", "yiisoft/yii2-faker": "*" diff --git a/composer.lock b/composer.lock new file mode 100644 index 000000000..ce0248cb8 --- /dev/null +++ b/composer.lock @@ -0,0 +1,1025 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "93894a180950d67c2b9edc7a95038f87", + "content-hash": "c8959aaf297f5e79479a01ef1dd73b02", + "packages": [ + { + "name": "bower-asset/bootstrap", + "version": "v3.3.5", + "source": { + "type": "git", + "url": "https://github.com/twbs/bootstrap.git", + "reference": "16b48259a62f576e52c903c476bd42b90ab22482" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twbs/bootstrap/zipball/16b48259a62f576e52c903c476bd42b90ab22482", + "reference": "16b48259a62f576e52c903c476bd42b90ab22482", + "shasum": "" + }, + "require": { + "bower-asset/jquery": ">=1.9.1" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": [ + "less/bootstrap.less", + "dist/js/bootstrap.js" + ], + "bower-asset-ignore": [ + "/.*", + "_config.yml", + "CNAME", + "composer.json", + "CONTRIBUTING.md", + "docs", + "js/tests", + "test-infra" + ] + }, + "license": [ + "MIT" + ], + "description": "The most popular front-end framework for developing responsive, mobile first projects on the web.", + "keywords": [ + "css", + "framework", + "front-end", + "js", + "less", + "mobile-first", + "responsive", + "web" + ] + }, + { + "name": "bower-asset/jquery", + "version": "2.2.4", + "source": { + "type": "git", + "url": "https://github.com/jquery/jquery-dist.git", + "reference": "c0185ab7c75aab88762c5aae780b9d83b80eda72" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jquery/jquery-dist/zipball/c0185ab7c75aab88762c5aae780b9d83b80eda72", + "reference": "c0185ab7c75aab88762c5aae780b9d83b80eda72", + "shasum": "" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": "dist/jquery.js", + "bower-asset-ignore": [ + "package.json" + ] + }, + "license": [ + "MIT" + ], + "keywords": [ + "browser", + "javascript", + "jquery", + "library" + ] + }, + { + "name": "bower-asset/jquery.inputmask", + "version": "3.2.7", + "source": { + "type": "git", + "url": "https://github.com/RobinHerbots/jquery.inputmask.git", + "reference": "5a72c563b502b8e05958a524cdfffafe9987be38" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/RobinHerbots/jquery.inputmask/zipball/5a72c563b502b8e05958a524cdfffafe9987be38", + "reference": "5a72c563b502b8e05958a524cdfffafe9987be38", + "shasum": "" + }, + "require": { + "bower-asset/jquery": ">=1.7" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": [ + "./dist/inputmask/inputmask.js" + ], + "bower-asset-ignore": [ + "**/*", + "!dist/*", + "!dist/inputmask/*", + "!dist/min/*", + "!dist/min/inputmask/*", + "!extra/bindings/*", + "!extra/dependencyLibs/*", + "!extra/phone-codes/*" + ] + }, + "license": [ + "http://opensource.org/licenses/mit-license.php" + ], + "description": "jquery.inputmask is a jquery plugin which create an input mask.", + "keywords": [ + "form", + "input", + "inputmask", + "jquery", + "mask", + "plugins" + ] + }, + { + "name": "bower-asset/punycode", + "version": "v1.3.2", + "source": { + "type": "git", + "url": "https://github.com/bestiejs/punycode.js.git", + "reference": "38c8d3131a82567bfef18da09f7f4db68c84f8a3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bestiejs/punycode.js/zipball/38c8d3131a82567bfef18da09f7f4db68c84f8a3", + "reference": "38c8d3131a82567bfef18da09f7f4db68c84f8a3", + "shasum": "" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": "punycode.js", + "bower-asset-ignore": [ + "coverage", + "tests", + ".*", + "component.json", + "Gruntfile.js", + "node_modules", + "package.json" + ] + } + }, + { + "name": "bower-asset/yii2-pjax", + "version": "v2.0.6", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/jquery-pjax.git", + "reference": "60728da6ade5879e807a49ce59ef9a72039b8978" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/jquery-pjax/zipball/60728da6ade5879e807a49ce59ef9a72039b8978", + "reference": "60728da6ade5879e807a49ce59ef9a72039b8978", + "shasum": "" + }, + "require": { + "bower-asset/jquery": ">=1.8" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": "./jquery.pjax.js", + "bower-asset-ignore": [ + ".travis.yml", + "Gemfile", + "Gemfile.lock", + "CONTRIBUTING.md", + "vendor/", + "script/", + "test/" + ] + }, + "license": [ + "MIT" + ] + }, + { + "name": "cebe/markdown", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/cebe/markdown.git", + "reference": "54a2c49de31cc44e864ebf0500a35ef21d0010b2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cebe/markdown/zipball/54a2c49de31cc44e864ebf0500a35ef21d0010b2", + "reference": "54a2c49de31cc44e864ebf0500a35ef21d0010b2", + "shasum": "" + }, + "require": { + "lib-pcre": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "cebe/indent": "*", + "facebook/xhprof": "*@dev", + "phpunit/phpunit": "4.1.*" + }, + "bin": [ + "bin/markdown" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "cebe\\markdown\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Carsten Brandt", + "email": "mail@cebe.cc", + "homepage": "http://cebe.cc/", + "role": "Creator" + } + ], + "description": "A super fast, highly extensible markdown parser for PHP", + "homepage": "https://github.com/cebe/markdown#readme", + "keywords": [ + "extensible", + "fast", + "gfm", + "markdown", + "markdown-extra" + ], + "time": "2015-03-06 05:28:07" + }, + { + "name": "ezyang/htmlpurifier", + "version": "v4.7.0", + "source": { + "type": "git", + "url": "https://github.com/ezyang/htmlpurifier.git", + "reference": "ae1828d955112356f7677c465f94f7deb7d27a40" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/ae1828d955112356f7677c465f94f7deb7d27a40", + "reference": "ae1828d955112356f7677c465f94f7deb7d27a40", + "shasum": "" + }, + "require": { + "php": ">=5.2" + }, + "type": "library", + "autoload": { + "psr-0": { + "HTMLPurifier": "library/" + }, + "files": [ + "library/HTMLPurifier.composer.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL" + ], + "authors": [ + { + "name": "Edward Z. Yang", + "email": "admin@htmlpurifier.org", + "homepage": "http://ezyang.com/" + } + ], + "description": "Standards compliant HTML filter written in PHP", + "homepage": "http://htmlpurifier.org/", + "keywords": [ + "html" + ], + "time": "2015-08-05 01:03:42" + }, + { + "name": "swiftmailer/swiftmailer", + "version": "v5.4.3", + "source": { + "type": "git", + "url": "https://github.com/swiftmailer/swiftmailer.git", + "reference": "4cc92842069c2bbc1f28daaaf1d2576ec4dfe153" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/4cc92842069c2bbc1f28daaaf1d2576ec4dfe153", + "reference": "4cc92842069c2bbc1f28daaaf1d2576ec4dfe153", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "mockery/mockery": "~0.9.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.4-dev" + } + }, + "autoload": { + "files": [ + "lib/swift_required.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Chris Corbyn" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Swiftmailer, free feature-rich PHP mailer", + "homepage": "http://swiftmailer.org/", + "keywords": [ + "email", + "mail", + "mailer" + ], + "time": "2016-07-08 11:51:25" + }, + { + "name": "yiisoft/yii2", + "version": "2.0.9", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-framework.git", + "reference": "2b75151ea60e1fd820046416eee2e89c3dda1133" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-framework/zipball/2b75151ea60e1fd820046416eee2e89c3dda1133", + "reference": "2b75151ea60e1fd820046416eee2e89c3dda1133", + "shasum": "" + }, + "require": { + "bower-asset/jquery": "2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable", + "bower-asset/jquery.inputmask": "~3.2.2", + "bower-asset/punycode": "1.3.*", + "bower-asset/yii2-pjax": "~2.0.1", + "cebe/markdown": "~1.0.0 | ~1.1.0", + "ext-ctype": "*", + "ext-mbstring": "*", + "ezyang/htmlpurifier": "~4.6", + "lib-pcre": "*", + "php": ">=5.4.0", + "yiisoft/yii2-composer": "~2.0.4" + }, + "bin": [ + "yii" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Qiang Xue", + "email": "qiang.xue@gmail.com", + "homepage": "http://www.yiiframework.com/", + "role": "Founder and project lead" + }, + { + "name": "Alexander Makarov", + "email": "sam@rmcreative.ru", + "homepage": "http://rmcreative.ru/", + "role": "Core framework development" + }, + { + "name": "Maurizio Domba", + "homepage": "http://mdomba.info/", + "role": "Core framework development" + }, + { + "name": "Carsten Brandt", + "email": "mail@cebe.cc", + "homepage": "http://cebe.cc/", + "role": "Core framework development" + }, + { + "name": "Timur Ruziev", + "email": "resurtm@gmail.com", + "homepage": "http://resurtm.com/", + "role": "Core framework development" + }, + { + "name": "Paul Klimov", + "email": "klimov.paul@gmail.com", + "role": "Core framework development" + }, + { + "name": "Dmitry Naumenko", + "email": "d.naumenko.a@gmail.com", + "role": "Core framework development" + } + ], + "description": "Yii PHP Framework Version 2", + "homepage": "http://www.yiiframework.com/", + "keywords": [ + "framework", + "yii2" + ], + "time": "2016-07-11 13:36:42" + }, + { + "name": "yiisoft/yii2-bootstrap", + "version": "2.0.6", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-bootstrap.git", + "reference": "3fd2b8c950cce79d60e9702d6bcb24eb3c80f6c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-bootstrap/zipball/3fd2b8c950cce79d60e9702d6bcb24eb3c80f6c5", + "reference": "3fd2b8c950cce79d60e9702d6bcb24eb3c80f6c5", + "shasum": "" + }, + "require": { + "bower-asset/bootstrap": "3.3.* | 3.2.* | 3.1.*", + "yiisoft/yii2": ">=2.0.6" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + }, + "asset-installer-paths": { + "npm-asset-library": "vendor/npm", + "bower-asset-library": "vendor/bower" + } + }, + "autoload": { + "psr-4": { + "yii\\bootstrap\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Qiang Xue", + "email": "qiang.xue@gmail.com" + } + ], + "description": "The Twitter Bootstrap extension for the Yii framework", + "keywords": [ + "bootstrap", + "yii2" + ], + "time": "2016-03-17 03:29:28" + }, + { + "name": "yiisoft/yii2-composer", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-composer.git", + "reference": "7452fd908a5023b8bb5ea1b123a174ca080de464" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-composer/zipball/7452fd908a5023b8bb5ea1b123a174ca080de464", + "reference": "7452fd908a5023b8bb5ea1b123a174ca080de464", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0" + }, + "type": "composer-plugin", + "extra": { + "class": "yii\\composer\\Plugin", + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\composer\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Qiang Xue", + "email": "qiang.xue@gmail.com" + } + ], + "description": "The composer plugin for Yii extension installer", + "keywords": [ + "composer", + "extension installer", + "yii2" + ], + "time": "2016-02-06 00:49:24" + }, + { + "name": "yiisoft/yii2-swiftmailer", + "version": "2.0.5", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-swiftmailer.git", + "reference": "e2c6315caff30a9271a7afad4d684627721dc69a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-swiftmailer/zipball/e2c6315caff30a9271a7afad4d684627721dc69a", + "reference": "e2c6315caff30a9271a7afad4d684627721dc69a", + "shasum": "" + }, + "require": { + "swiftmailer/swiftmailer": "~5.0", + "yiisoft/yii2": ">=2.0.4" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\swiftmailer\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Paul Klimov", + "email": "klimov.paul@gmail.com" + } + ], + "description": "The SwiftMailer integration for the Yii framework", + "keywords": [ + "email", + "mail", + "mailer", + "swift", + "swiftmailer", + "yii2" + ], + "time": "2016-03-17 03:58:49" + } + ], + "packages-dev": [ + { + "name": "bower-asset/typeahead.js", + "version": "v0.11.1", + "source": { + "type": "git", + "url": "https://github.com/twitter/typeahead.js.git", + "reference": "588440f66559714280628a4f9799f0c4eb880a4a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twitter/typeahead.js/zipball/588440f66559714280628a4f9799f0c4eb880a4a", + "reference": "588440f66559714280628a4f9799f0c4eb880a4a", + "shasum": "" + }, + "require": { + "bower-asset/jquery": ">=1.7" + }, + "require-dev": { + "bower-asset/jasmine-ajax": "~1.3.1", + "bower-asset/jasmine-jquery": "~1.5.2", + "bower-asset/jquery": "~1.7" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": "dist/typeahead.bundle.js" + } + }, + { + "name": "codeception/specify", + "version": "0.4.3", + "source": { + "type": "git", + "url": "https://github.com/Codeception/Specify.git", + "reference": "8efcd017687ebdae9c4d95bcbc1dc22a28561874" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Codeception/Specify/zipball/8efcd017687ebdae9c4d95bcbc1dc22a28561874", + "reference": "8efcd017687ebdae9c4d95bcbc1dc22a28561874", + "shasum": "" + }, + "require": { + "myclabs/deep-copy": "~1.1", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "Codeception\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "authors": [ + { + "name": "Michael Bodnarchuk", + "email": "davert.php@mailican.com" + } + ], + "description": "BDD code blocks for PHPUnit and Codeception", + "time": "2015-11-26 23:35:52" + }, + { + "name": "codeception/verify", + "version": "0.3.0", + "source": { + "type": "git", + "url": "https://github.com/Codeception/Verify.git", + "reference": "d3721cfc668d96b41acbda3ecd01d3499381db64" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Codeception/Verify/zipball/d3721cfc668d96b41acbda3ecd01d3499381db64", + "reference": "d3721cfc668d96b41acbda3ecd01d3499381db64", + "shasum": "" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "autoload": { + "files": [ + "src/Codeception/function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "authors": [ + { + "name": "Michael Bodnarchuk", + "email": "davert.php@mailican.com" + } + ], + "description": "BDD assertion library for PHPUnit", + "time": "2015-11-26 23:23:25" + }, + { + "name": "fzaninotto/faker", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/fzaninotto/Faker.git", + "reference": "44f9a286a04b80c76a4e5fb7aad8bb539b920123" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/44f9a286a04b80c76a4e5fb7aad8bb539b920123", + "reference": "44f9a286a04b80c76a4e5fb7aad8bb539b920123", + "shasum": "" + }, + "require": { + "php": "^5.3.3|^7.0" + }, + "require-dev": { + "ext-intl": "*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~1.5" + }, + "type": "library", + "extra": { + "branch-alias": [] + }, + "autoload": { + "psr-4": { + "Faker\\": "src/Faker/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "François Zaninotto" + } + ], + "description": "Faker is a PHP library that generates fake data for you.", + "keywords": [ + "data", + "faker", + "fixtures" + ], + "time": "2016-04-29 12:21:54" + }, + { + "name": "myclabs/deep-copy", + "version": "1.5.1", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "a8773992b362b58498eed24bf85005f363c34771" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/a8773992b362b58498eed24bf85005f363c34771", + "reference": "a8773992b362b58498eed24bf85005f363c34771", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "doctrine/collections": "1.*", + "phpunit/phpunit": "~4.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "homepage": "https://github.com/myclabs/DeepCopy", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "time": "2015-11-20 12:04:31" + }, + { + "name": "phpspec/php-diff", + "version": "v1.1.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/php-diff.git", + "reference": "0464787bfa7cd13576c5a1e318709768798bec6a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/php-diff/zipball/0464787bfa7cd13576c5a1e318709768798bec6a", + "reference": "0464787bfa7cd13576c5a1e318709768798bec6a", + "shasum": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Diff": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Chris Boulton", + "homepage": "http://github.com/chrisboulton" + } + ], + "description": "A comprehensive library for generating differences between two hashable objects (strings or arrays).", + "time": "2016-04-07 12:29:16" + }, + { + "name": "yiisoft/yii2-codeception", + "version": "2.0.5", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-codeception.git", + "reference": "c916a36d09fc128b05a374e7922bc56854334d56" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-codeception/zipball/c916a36d09fc128b05a374e7922bc56854334d56", + "reference": "c916a36d09fc128b05a374e7922bc56854334d56", + "shasum": "" + }, + "require": { + "yiisoft/yii2": ">=2.0.4" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\codeception\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Mark Jebri", + "email": "mark.github@yandex.ru" + } + ], + "description": "The Codeception integration for the Yii framework", + "keywords": [ + "codeception", + "yii2" + ], + "time": "2016-03-17 03:41:26" + }, + { + "name": "yiisoft/yii2-debug", + "version": "2.0.6", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-debug.git", + "reference": "55ed2e853ed8050a34415f63a4da84f88a56f895" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-debug/zipball/55ed2e853ed8050a34415f63a4da84f88a56f895", + "reference": "55ed2e853ed8050a34415f63a4da84f88a56f895", + "shasum": "" + }, + "require": { + "yiisoft/yii2": ">=2.0.4", + "yiisoft/yii2-bootstrap": "*" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\debug\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Qiang Xue", + "email": "qiang.xue@gmail.com" + } + ], + "description": "The debugger extension for the Yii framework", + "keywords": [ + "debug", + "debugger", + "yii2" + ], + "time": "2016-03-17 03:50:19" + }, + { + "name": "yiisoft/yii2-faker", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-faker.git", + "reference": "b88ca69ee226a3610b2c26c026c3203d7ac50f6c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-faker/zipball/b88ca69ee226a3610b2c26c026c3203d7ac50f6c", + "reference": "b88ca69ee226a3610b2c26c026c3203d7ac50f6c", + "shasum": "" + }, + "require": { + "fzaninotto/faker": "*", + "yiisoft/yii2": "*" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\faker\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Mark Jebri", + "email": "mark.github@yandex.ru" + } + ], + "description": "Fixture generator. The Faker integration for the Yii framework.", + "keywords": [ + "Fixture", + "faker", + "yii2" + ], + "time": "2015-03-01 06:22:44" + }, + { + "name": "yiisoft/yii2-gii", + "version": "2.0.5", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-gii.git", + "reference": "1bd6df6804ca077ec022587905a0d43eb286f507" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-gii/zipball/1bd6df6804ca077ec022587905a0d43eb286f507", + "reference": "1bd6df6804ca077ec022587905a0d43eb286f507", + "shasum": "" + }, + "require": { + "bower-asset/typeahead.js": "0.10.* | ~0.11.0", + "phpspec/php-diff": ">=1.0.2", + "yiisoft/yii2": ">=2.0.4", + "yiisoft/yii2-bootstrap": "~2.0" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + }, + "asset-installer-paths": { + "npm-asset-library": "vendor/npm", + "bower-asset-library": "vendor/bower" + } + }, + "autoload": { + "psr-4": { + "yii\\gii\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Qiang Xue", + "email": "qiang.xue@gmail.com" + } + ], + "description": "The Gii extension for the Yii framework", + "keywords": [ + "code generator", + "gii", + "yii2" + ], + "time": "2016-03-18 14:09:46" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.4.0" + }, + "platform-dev": [] +} diff --git a/config/test.php b/config/test.php new file mode 100644 index 000000000..03b6580dd --- /dev/null +++ b/config/test.php @@ -0,0 +1,35 @@ + 'basic-tests', + 'basePath' => dirname(__DIR__), + 'language' => 'en-US', + 'components' => [ + 'db' => $dbParams, + 'mailer' => [ + 'useFileTransport' => true, + ], + 'urlManager' => [ + 'showScriptName' => true, + ], + 'request' => [ + // it's not recommended to run functional tests with CSRF validation enabled + 'enableCsrfValidation' => false, + // but if you absolutely need it set cookie domain to localhost + /* + 'csrfCookie' => [ + 'domain' => 'localhost', + ], + */ + ], + ], + 'params' => $params, +]; diff --git a/config/web.php b/config/web.php index 90a82876b..a45b77cd8 100644 --- a/config/web.php +++ b/config/web.php @@ -9,7 +9,7 @@ 'components' => [ 'request' => [ // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation - 'cookieValidationKey' => '', + 'cookieValidationKey' => '12334543543', ], 'cache' => [ 'class' => 'yii\caching\FileCache', diff --git a/tests/_bootstrap.php b/tests/_bootstrap.php new file mode 100644 index 000000000..c7f5cfc4f --- /dev/null +++ b/tests/_bootstrap.php @@ -0,0 +1,10 @@ + $value) { + $inputType = $field === 'body' ? 'textarea' : 'input'; + $this->actor->fillField($inputType . '[name="ContactForm[' . $field . ']"]', $value); + } + $this->actor->click('contact-button'); + } +} diff --git a/tests/codeception/_pages/LoginPage.php b/tests/_pages/LoginPage.php similarity index 100% rename from tests/codeception/_pages/LoginPage.php rename to tests/_pages/LoginPage.php diff --git a/tests/_support/AcceptanceTester.php b/tests/_support/AcceptanceTester.php new file mode 100644 index 000000000..4c7dcbb6d --- /dev/null +++ b/tests/_support/AcceptanceTester.php @@ -0,0 +1,26 @@ +getScenario()->runStep(new \Codeception\Step\Action('setHeader', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Authenticates user for HTTP_AUTH + * + * @param $username + * @param $password + * @see \Codeception\Module\PhpBrowser::amHttpAuthenticated() + */ + public function amHttpAuthenticated($username, $password) { + return $this->getScenario()->runStep(new \Codeception\Step\Condition('amHttpAuthenticated', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Open web page at the given absolute URL and sets its hostname as the base host. + * + * ``` php + * amOnUrl('http://codeception.com/'); + * $I->amOnPage('/quickstart'); // moves to http://codeception.com/quickstart + * ?> + * ``` + * @see \Codeception\Module\PhpBrowser::amOnUrl() + */ + public function amOnUrl($url) { + return $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnUrl', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Changes the subdomain for the 'url' configuration parameter. + * Does not open a page; use `amOnPage` for that. + * + * ``` php + * amOnSubdomain('user'); + * $I->amOnPage('/'); + * // moves to http://user.mysite.com/ + * ?> + * ``` + * + * @param $subdomain + * + * @return mixed + * @see \Codeception\Module\PhpBrowser::amOnSubdomain() + */ + public function amOnSubdomain($subdomain) { + return $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnSubdomain', func_get_args())); + } + + + /** + * [!] 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 + * + * Example: + * + * ``` php + * executeInGuzzle(function (\GuzzleHttp\Client $client) { + * $client->get('/get', ['query' => ['foo' => 'bar']]); + * }); + * ?> + * ``` + * + * It is not recommended to use this command on a regular basis. + * If Codeception lacks important Guzzle Client methods, implement them and submit patches. + * + * @param callable $function + * @see \Codeception\Module\PhpBrowser::executeInGuzzle() + */ + public function executeInGuzzle($function) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('executeInGuzzle', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Sets the HTTP header to the passed value - which is used on + * subsequent HTTP requests through PhpBrowser. + * + * Example: + * ```php + * setHeader('X-Requested-With', 'Codeception'); + * $I->amOnPage('test-headers.php'); + * ?> + * ``` + * + * @param string $name the name of the request header + * @param string $value the value to set it to for subsequent + * requests + * @see \Codeception\Lib\InnerBrowser::haveHttpHeader() + */ + public function haveHttpHeader($name, $value) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('haveHttpHeader', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Deletes the header with the passed name. Subsequent requests + * will not have the deleted header in its request. + * + * Example: + * ```php + * haveHttpHeader('X-Requested-With', 'Codeception'); + * $I->amOnPage('test-headers.php'); + * // ... + * $I->deleteHeader('X-Requested-With'); + * $I->amOnPage('some-other-page.php'); + * ?> + * ``` + * + * @param string $name the name of the header to delete. + * @see \Codeception\Lib\InnerBrowser::deleteHeader() + */ + public function deleteHeader($name) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('deleteHeader', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Opens the page for the given relative URI. + * + * ``` php + * amOnPage('/'); + * // opens /register page + * $I->amOnPage('/register'); + * ``` + * + * @param $page + * @see \Codeception\Lib\InnerBrowser::amOnPage() + */ + public function amOnPage($page) { + return $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnPage', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Perform a click on a link or a button, given by a locator. + * If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string. + * For buttons, the "value" attribute, "name" attribute, and inner text are searched. + * For links, the link text is searched. + * For images, the "alt" attribute and inner text of any parent links are searched. + * + * The second parameter is a context (CSS or XPath locator) to narrow the search. + * + * Note that if the locator matches a button of type `submit`, the form will be submitted. + * + * ``` php + * click('Logout'); + * // button of form + * $I->click('Submit'); + * // CSS button + * $I->click('#form input[type=submit]'); + * // XPath + * $I->click('//form/*[@type=submit]'); + * // link in context + * $I->click('Logout', '#nav'); + * // using strict locator + * $I->click(['link' => 'Login']); + * ?> + * ``` + * + * @param $link + * @param $context + * @see \Codeception\Lib\InnerBrowser::click() + */ + public function click($link, $context = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('click', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current page contains the given string (case insensitive). + * + * You can specify a specific HTML element (via CSS or XPath) as the second + * parameter to only search within that element. + * + * ``` 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 + * ``` + * + * Note that the search is done after stripping all HTML tags from the body, + * so `$I->see('strong')` will return true for strings like: + * + * - `

    I am Stronger than thou

    ` + * - `` + * + * But will *not* be true for strings like: + * + * - `Home` + * - `
    Home` + * - `` + * + * For checking the raw source code, use `seeInSource()`. + * + * @param $text + * @param null $selector + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::see() + */ + public function canSee($text, $selector = null) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('see', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current page contains the given string (case insensitive). + * + * You can specify a specific HTML element (via CSS or XPath) as the second + * parameter to only search within that element. + * + * ``` 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 + * ``` + * + * Note that the search is done after stripping all HTML tags from the body, + * so `$I->see('strong')` will return true for strings like: + * + * - `

    I am Stronger than thou

    ` + * - `` + * + * But will *not* be true for strings like: + * + * - `Home` + * - `
    Home` + * - `` + * + * For checking the raw source code, use `seeInSource()`. + * + * @param $text + * @param null $selector + * @see \Codeception\Lib\InnerBrowser::see() + */ + public function see($text, $selector = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('see', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current page doesn't contain the text specified (case insensitive). + * Give a locator as the second parameter to match a specific region. + * + * ```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 + * ``` + * + * Note that the search is done after stripping all HTML tags from the body, + * so `$I->dontSee('strong')` will fail on strings like: + * + * - `

    I am Stronger than thou

    ` + * - `` + * + * But will ignore strings like: + * + * - `Home` + * - `
    Home` + * - `` + * + * For checking the raw source code, use `seeInSource()`. + * + * @param $text + * @param null $selector + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSee() + */ + public function cantSee($text, $selector = null) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSee', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current page doesn't contain the text specified (case insensitive). + * Give a locator as the second parameter to match a specific region. + * + * ```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 + * ``` + * + * Note that the search is done after stripping all HTML tags from the body, + * so `$I->dontSee('strong')` will fail on strings like: + * + * - `

    I am Stronger than thou

    ` + * - `` + * + * But will ignore strings like: + * + * - `Home` + * - `
    Home` + * - `` + * + * For checking the raw source code, use `seeInSource()`. + * + * @param $text + * @param null $selector + * @see \Codeception\Lib\InnerBrowser::dontSee() + */ + public function dontSee($text, $selector = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSee', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current page contains the given string in its + * raw source code. + * + * ``` php + * seeInSource('

    Green eggs & ham

    '); + * ``` + * + * @param $raw + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeInSource() + */ + public function canSeeInSource($raw) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInSource', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current page contains the given string in its + * raw source code. + * + * ``` php + * seeInSource('

    Green eggs & ham

    '); + * ``` + * + * @param $raw + * @see \Codeception\Lib\InnerBrowser::seeInSource() + */ + public function seeInSource($raw) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInSource', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current page contains the given string in its + * raw source code. + * + * ```php + * dontSeeInSource('

    Green eggs & ham

    '); + * ``` + * + * @param $raw + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeInSource() + */ + public function cantSeeInSource($raw) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInSource', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current page contains the given string in its + * raw source code. + * + * ```php + * dontSeeInSource('

    Green eggs & ham

    '); + * ``` + * + * @param $raw + * @see \Codeception\Lib\InnerBrowser::dontSeeInSource() + */ + public function dontSeeInSource($raw) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInSource', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that there's a link with the specified text. + * Give a full URL as the second parameter to match links with that exact URL. + * + * ``` php + * 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\Lib\InnerBrowser::seeLink() + */ + public function canSeeLink($text, $url = null) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeLink', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that there's a link with the specified text. + * Give a full URL as the second parameter to match links with that exact URL. + * + * ``` php + * seeLink('Logout'); // matches Logout + * $I->seeLink('Logout','/logout'); // matches Logout + * ?> + * ``` + * + * @param $text + * @param null $url + * @see \Codeception\Lib\InnerBrowser::seeLink() + */ + public function seeLink($text, $url = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeLink', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the page doesn't contain a link with the given string. + * If the second parameter is given, only links with a matching "href" attribute will be checked. + * + * ``` php + * dontSeeLink('Logout'); // I suppose user is not logged in + * $I->dontSeeLink('Checkout now', '/store/cart.php'); + * ?> + * ``` + * + * @param $text + * @param null $url + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeLink() + */ + public function cantSeeLink($text, $url = null) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeLink', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the page doesn't contain a link with the given string. + * If the second parameter is given, only links with a matching "href" attribute will be checked. + * + * ``` php + * dontSeeLink('Logout'); // I suppose user is not logged in + * $I->dontSeeLink('Checkout now', '/store/cart.php'); + * ?> + * ``` + * + * @param $text + * @param null $url + * @see \Codeception\Lib\InnerBrowser::dontSeeLink() + */ + public function dontSeeLink($text, $url = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeLink', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that current URI contains the given string. + * + * ``` php + * seeInCurrentUrl('home'); + * // to match: /users/1 + * $I->seeInCurrentUrl('/users/'); + * ?> + * ``` + * + * @param $uri + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeInCurrentUrl() + */ + public function canSeeInCurrentUrl($uri) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInCurrentUrl', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that current URI contains the given string. + * + * ``` php + * seeInCurrentUrl('home'); + * // to match: /users/1 + * $I->seeInCurrentUrl('/users/'); + * ?> + * ``` + * + * @param $uri + * @see \Codeception\Lib\InnerBrowser::seeInCurrentUrl() + */ + public function seeInCurrentUrl($uri) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInCurrentUrl', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current URI doesn't contain the given string. + * + * ``` php + * dontSeeInCurrentUrl('/users/'); + * ?> + * ``` + * + * @param $uri + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeInCurrentUrl() + */ + public function cantSeeInCurrentUrl($uri) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInCurrentUrl', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current URI doesn't contain the given string. + * + * ``` php + * dontSeeInCurrentUrl('/users/'); + * ?> + * ``` + * + * @param $uri + * @see \Codeception\Lib\InnerBrowser::dontSeeInCurrentUrl() + */ + public function dontSeeInCurrentUrl($uri) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInCurrentUrl', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current URL is equal to the given string. + * Unlike `seeInCurrentUrl`, this only matches the full URL. + * + * ``` php + * seeCurrentUrlEquals('/'); + * ?> + * ``` + * + * @param $uri + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlEquals() + */ + public function canSeeCurrentUrlEquals($uri) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlEquals', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current URL is equal to the given string. + * Unlike `seeInCurrentUrl`, this only matches the full URL. + * + * ``` php + * seeCurrentUrlEquals('/'); + * ?> + * ``` + * + * @param $uri + * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlEquals() + */ + public function seeCurrentUrlEquals($uri) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCurrentUrlEquals', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current URL doesn't equal the given string. + * Unlike `dontSeeInCurrentUrl`, this only matches the full URL. + * + * ``` php + * dontSeeCurrentUrlEquals('/'); + * ?> + * ``` + * + * @param $uri + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlEquals() + */ + public function cantSeeCurrentUrlEquals($uri) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlEquals', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current URL doesn't equal the given string. + * Unlike `dontSeeInCurrentUrl`, this only matches the full URL. + * + * ``` php + * dontSeeCurrentUrlEquals('/'); + * ?> + * ``` + * + * @param $uri + * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlEquals() + */ + public function dontSeeCurrentUrlEquals($uri) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlEquals', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current URL matches the given regular expression. + * + * ``` php + * seeCurrentUrlMatches('~$/users/(\d+)~'); + * ?> + * ``` + * + * @param $uri + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlMatches() + */ + public function canSeeCurrentUrlMatches($uri) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlMatches', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current URL matches the given regular expression. + * + * ``` php + * seeCurrentUrlMatches('~$/users/(\d+)~'); + * ?> + * ``` + * + * @param $uri + * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlMatches() + */ + public function seeCurrentUrlMatches($uri) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCurrentUrlMatches', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that current url doesn't match the given regular expression. + * + * ``` php + * dontSeeCurrentUrlMatches('~$/users/(\d+)~'); + * ?> + * ``` + * + * @param $uri + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlMatches() + */ + public function cantSeeCurrentUrlMatches($uri) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlMatches', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that current url doesn't match the given regular expression. + * + * ``` php + * dontSeeCurrentUrlMatches('~$/users/(\d+)~'); + * ?> + * ``` + * + * @param $uri + * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlMatches() + */ + public function dontSeeCurrentUrlMatches($uri) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlMatches', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Executes the given regular expression against the current URI and returns the first match. + * If no parameters are provided, the full URI is returned. + * + * ``` php + * grabFromCurrentUrl('~$/user/(\d+)/~'); + * $uri = $I->grabFromCurrentUrl(); + * ?> + * ``` + * + * @param null $uri + * + * @return mixed + * @see \Codeception\Lib\InnerBrowser::grabFromCurrentUrl() + */ + public function grabFromCurrentUrl($uri = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('grabFromCurrentUrl', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the specified checkbox is checked. + * + * ``` 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\Lib\InnerBrowser::seeCheckboxIsChecked() + */ + public function canSeeCheckboxIsChecked($checkbox) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCheckboxIsChecked', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the specified checkbox is checked. + * + * ``` 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\Lib\InnerBrowser::seeCheckboxIsChecked() + */ + public function seeCheckboxIsChecked($checkbox) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCheckboxIsChecked', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Check that the specified checkbox is unchecked. + * + * ``` 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\Lib\InnerBrowser::dontSeeCheckboxIsChecked() + */ + public function cantSeeCheckboxIsChecked($checkbox) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCheckboxIsChecked', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Check that the specified checkbox is unchecked. + * + * ``` 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\Lib\InnerBrowser::dontSeeCheckboxIsChecked() + */ + public function dontSeeCheckboxIsChecked($checkbox) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCheckboxIsChecked', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the given input field or textarea contains the given value. + * For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath. + * + * ``` 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'); + * $I->seeInField(['name' => 'search'], 'Search'); + * ?> + * ``` + * + * @param $field + * @param $value + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeInField() + */ + public function canSeeInField($field, $value) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInField', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the given input field or textarea contains the given value. + * For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath. + * + * ``` 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'); + * $I->seeInField(['name' => 'search'], 'Search'); + * ?> + * ``` + * + * @param $field + * @param $value + * @see \Codeception\Lib\InnerBrowser::seeInField() + */ + public function seeInField($field, $value) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInField', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that an input field or textarea doesn't contain the given value. + * For fuzzy locators, the field is matched by label text, CSS and XPath. + * + * ``` 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'); + * $I->dontSeeInField(['name' => 'search'], 'Search'); + * ?> + * ``` + * + * @param $field + * @param $value + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeInField() + */ + public function cantSeeInField($field, $value) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInField', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that an input field or textarea doesn't contain the given value. + * For fuzzy locators, the field is matched by label text, CSS and XPath. + * + * ``` 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'); + * $I->dontSeeInField(['name' => 'search'], 'Search'); + * ?> + * ``` + * + * @param $field + * @param $value + * @see \Codeception\Lib\InnerBrowser::dontSeeInField() + */ + public function dontSeeInField($field, $value) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInField', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if the array of form parameters (name => value) are set on the form matched with the + * passed selector. + * + * ``` php + * seeInFormFields('form[name=myform]', [ + * 'input1' => 'value', + * 'input2' => 'other value', + * ]); + * ?> + * ``` + * + * For multi-select elements, or to check values of multiple elements with the same name, an + * array may be passed: + * + * ``` php + * seeInFormFields('.form-class', [ + * 'multiselect' => [ + * 'value1', + * 'value2', + * ], + * 'checkbox[]' => [ + * 'a checked value', + * 'another checked value', + * ], + * ]); + * ?> + * ``` + * + * Additionally, checkbox values can be checked with a boolean. + * + * ``` php + * seeInFormFields('#form-id', [ + * 'checkbox1' => true, // passes if checked + * 'checkbox2' => false, // passes if unchecked + * ]); + * ?> + * ``` + * + * Pair this with submitForm for quick testing magic. + * + * ``` php + * 'value', + * 'field2' => 'another value', + * 'checkbox1' => true, + * // ... + * ]; + * $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); + * // $I->amOnPage('/path/to/form-page') may be needed + * $I->seeInFormFields('//form[@id=my-form]', $form); + * ?> + * ``` + * + * @param $formSelector + * @param $params + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeInFormFields() + */ + public function canSeeInFormFields($formSelector, $params) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInFormFields', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if the array of form parameters (name => value) are set on the form matched with the + * passed selector. + * + * ``` php + * seeInFormFields('form[name=myform]', [ + * 'input1' => 'value', + * 'input2' => 'other value', + * ]); + * ?> + * ``` + * + * For multi-select elements, or to check values of multiple elements with the same name, an + * array may be passed: + * + * ``` php + * seeInFormFields('.form-class', [ + * 'multiselect' => [ + * 'value1', + * 'value2', + * ], + * 'checkbox[]' => [ + * 'a checked value', + * 'another checked value', + * ], + * ]); + * ?> + * ``` + * + * Additionally, checkbox values can be checked with a boolean. + * + * ``` php + * seeInFormFields('#form-id', [ + * 'checkbox1' => true, // passes if checked + * 'checkbox2' => false, // passes if unchecked + * ]); + * ?> + * ``` + * + * Pair this with submitForm for quick testing magic. + * + * ``` php + * 'value', + * 'field2' => 'another value', + * 'checkbox1' => true, + * // ... + * ]; + * $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); + * // $I->amOnPage('/path/to/form-page') may be needed + * $I->seeInFormFields('//form[@id=my-form]', $form); + * ?> + * ``` + * + * @param $formSelector + * @param $params + * @see \Codeception\Lib\InnerBrowser::seeInFormFields() + */ + public function seeInFormFields($formSelector, $params) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInFormFields', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if the array of form parameters (name => value) are not set on the form matched with + * the passed selector. + * + * ``` php + * dontSeeInFormFields('form[name=myform]', [ + * 'input1' => 'non-existent value', + * 'input2' => 'other non-existent value', + * ]); + * ?> + * ``` + * + * To check that an element hasn't been assigned any one of many values, an array can be passed + * as the value: + * + * ``` php + * dontSeeInFormFields('.form-class', [ + * 'fieldName' => [ + * 'This value shouldn\'t be set', + * 'And this value shouldn\'t be set', + * ], + * ]); + * ?> + * ``` + * + * Additionally, checkbox values can be checked with a boolean. + * + * ``` php + * dontSeeInFormFields('#form-id', [ + * 'checkbox1' => true, // fails if checked + * 'checkbox2' => false, // fails if unchecked + * ]); + * ?> + * ``` + * + * @param $formSelector + * @param $params + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeInFormFields() + */ + public function cantSeeInFormFields($formSelector, $params) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInFormFields', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if the array of form parameters (name => value) are not set on the form matched with + * the passed selector. + * + * ``` php + * dontSeeInFormFields('form[name=myform]', [ + * 'input1' => 'non-existent value', + * 'input2' => 'other non-existent value', + * ]); + * ?> + * ``` + * + * To check that an element hasn't been assigned any one of many values, an array can be passed + * as the value: + * + * ``` php + * dontSeeInFormFields('.form-class', [ + * 'fieldName' => [ + * 'This value shouldn\'t be set', + * 'And this value shouldn\'t be set', + * ], + * ]); + * ?> + * ``` + * + * Additionally, checkbox values can be checked with a boolean. + * + * ``` php + * dontSeeInFormFields('#form-id', [ + * 'checkbox1' => true, // fails if checked + * 'checkbox2' => false, // fails if unchecked + * ]); + * ?> + * ``` + * + * @param $formSelector + * @param $params + * @see \Codeception\Lib\InnerBrowser::dontSeeInFormFields() + */ + public function dontSeeInFormFields($formSelector, $params) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInFormFields', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Submits the given form on the page, optionally with the given form + * values. Pass the form field's values as an array in the second + * parameter. + * + * Although this function can be used as a short-hand version of + * `fillField()`, `selectOption()`, `click()` etc. it has some important + * differences: + * + * * Only field *names* may be used, not CSS/XPath selectors nor field labels + * * If a field is sent to this function that does *not* exist on the page, + * it will silently be added to the HTTP request. This is helpful for testing + * some types of forms, but be aware that you will *not* get an exception + * like you would if you called `fillField()` or `selectOption()` with + * a missing field. + * + * Fields that are not provided will be filled by their values from the page, + * or from any previous calls to `fillField()`, `selectOption()` etc. + * You don't need to click the 'Submit' button afterwards. + * This command itself triggers the request to form's action. + * + * You can optionally specify which button's value to include + * in the request with the last parameter (as an alternative to + * explicitly setting its value in the second parameter), as + * button values are not otherwise included in the request. + * + * Examples: + * + * ``` php + * submitForm('#login', [ + * 'login' => 'davert', + * 'password' => '123456' + * ]); + * // or + * $I->submitForm('#login', [ + * 'login' => 'davert', + * 'password' => '123456' + * ], 'submitButtonName'); + * + * ``` + * + * For example, given this sample "Sign Up" form: + * + * ``` html + *
    + * Login: + *
    + * Password: + *
    + * Do you agree to our terms? + *
    + * Select pricing plan: + * + * + *
    + * ``` + * + * You could write the following to submit it: + * + * ``` php + * submitForm( + * '#userForm', + * [ + * 'user' => [ + * 'login' => 'Davert', + * 'password' => '123456', + * 'agree' => true + * ] + * ], + * 'submitButton' + * ); + * ``` + * Note that "2" will be the submitted value for the "plan" field, as it is + * the selected option. + * + * You can also emulate a JavaScript submission by not specifying any + * buttons in the third parameter to submitForm. + * + * ```php + * submitForm( + * '#userForm', + * [ + * 'user' => [ + * 'login' => 'Davert', + * 'password' => '123456', + * 'agree' => true + * ] + * ] + * ); + * ``` + * + * This function works well when paired with `seeInFormFields()` + * for quickly testing CRUD interfaces and form validation logic. + * + * ``` php + * 'value', + * 'field2' => 'another value', + * 'checkbox1' => true, + * // ... + * ]; + * $I->submitForm('#my-form', $form, 'submitButton'); + * // $I->amOnPage('/path/to/form-page') may be needed + * $I->seeInFormFields('#my-form', $form); + * ``` + * + * Parameter values can be set to arrays for multiple input fields + * of the same name, or multi-select combo boxes. For checkboxes, + * you can use either the string value or boolean `true`/`false` which will + * be replaced by the checkbox's value in the DOM. + * + * ``` php + * submitForm('#my-form', [ + * 'field1' => 'value', + * 'checkbox' => [ + * 'value of first checkbox', + * 'value of second checkbox', + * ], + * 'otherCheckboxes' => [ + * true, + * false, + * false + * ], + * 'multiselect' => [ + * 'first option value', + * 'second option value' + * ] + * ]); + * ``` + * + * Mixing string and boolean values for a checkbox's value is not supported + * and may produce unexpected results. + * + * Field names ending in `[]` must be passed without the trailing square + * bracket characters, and must contain an array for its value. This allows + * submitting multiple values with the same name, consider: + * + * ```php + * submitForm('#my-form', [ + * 'field[]' => 'value', + * 'field[]' => 'another value', // 'field[]' is already a defined key + * ]); + * ``` + * + * The solution is to pass an array value: + * + * ```php + * submitForm('#my-form', [ + * 'field' => [ + * 'value', + * 'another value', + * ] + * ]); + * ``` + * + * @param $selector + * @param $params + * @param $button + * @see \Codeception\Lib\InnerBrowser::submitForm() + */ + public function submitForm($selector, $params, $button = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('submitForm', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Fills a text field or textarea with the given string. + * + * ``` php + * fillField("//input[@type='text']", "Hello World!"); + * $I->fillField(['name' => 'email'], 'jon@mail.com'); + * ?> + * ``` + * + * @param $field + * @param $value + * @see \Codeception\Lib\InnerBrowser::fillField() + */ + public function fillField($field, $value) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('fillField', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Selects an option in a select tag or in radio button group. + * + * ``` php + * selectOption('form select[name=account]', 'Premium'); + * $I->selectOption('form input[name=payment]', 'Monthly'); + * $I->selectOption('//form/select[@name=account]', 'Monthly'); + * ?> + * ``` + * + * Provide an array for the second argument to select multiple options: + * + * ``` php + * selectOption('Which OS do you use?', array('Windows','Linux')); + * ?> + * ``` + * + * Or provide an associative array for the second argument to specifically define which selection method should be used: + * + * ``` php + * selectOption('Which OS do you use?', array('text' => 'Windows')); // Only search by text 'Windows' + * $I->selectOption('Which OS do you use?', array('value' => 'windows')); // Only search by value 'windows' + * ?> + + ``` + * + * @param $select + * @param $option + * @see \Codeception\Lib\InnerBrowser::selectOption() + */ + public function selectOption($select, $option) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('selectOption', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Ticks a checkbox. For radio buttons, use the `selectOption` method instead. + * + * ``` php + * checkOption('#agree'); + * ?> + * ``` + * + * @param $option + * @see \Codeception\Lib\InnerBrowser::checkOption() + */ + public function checkOption($option) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('checkOption', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Unticks a checkbox. + * + * ``` php + * uncheckOption('#notify'); + * ?> + * ``` + * + * @param $option + * @see \Codeception\Lib\InnerBrowser::uncheckOption() + */ + public function uncheckOption($option) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('uncheckOption', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Attaches a file relative to the Codeception data directory to the given file upload field. + * + * ``` php + * attachFile('input[@type="file"]', 'prices.xls'); + * ?> + * ``` + * + * @param $field + * @param $filename + * @see \Codeception\Lib\InnerBrowser::attachFile() + */ + public function attachFile($field, $filename) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('attachFile', func_get_args())); + } + + + /** + * [!] 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. + * + * See ->sendAjaxPostRequest for examples. + * + * @param $uri + * @param $params + * @see \Codeception\Lib\InnerBrowser::sendAjaxGetRequest() + */ + public function sendAjaxGetRequest($uri, $params = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('sendAjaxGetRequest', func_get_args())); + } + + + /** + * [!] 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. + * + * Example: + * + * Imagine that by clicking checkbox you trigger ajax request which updates user settings. + * We emulate that click by running this ajax request manually. + * + * ``` php + * sendAjaxPostRequest('/updateSettings', array('notifications' => true)); // POST + * $I->sendAjaxGetRequest('/updateSettings', array('notifications' => true)); // GET + * + * ``` + * + * @param $uri + * @param $params + * @see \Codeception\Lib\InnerBrowser::sendAjaxPostRequest() + */ + public function sendAjaxPostRequest($uri, $params = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('sendAjaxPostRequest', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * If your page triggers an ajax request, you can perform it manually. + * This action sends an ajax request with specified method and params. + * + * Example: + * + * You need to perform an ajax request specifying the HTTP method. + * + * ``` php + * sendAjaxRequest('PUT', '/posts/7', array('title' => 'new title')); + * + * ``` + * + * @param $method + * @param $uri + * @param $params + * @see \Codeception\Lib\InnerBrowser::sendAjaxRequest() + */ + public function sendAjaxRequest($method, $uri, $params = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('sendAjaxRequest', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Finds and returns the text contents of the given element. + * If a fuzzy locator is used, the element is found using CSS, XPath, + * and by matching the full page source by regular expression. + * + * ``` php + * grabTextFrom('h1'); + * $heading = $I->grabTextFrom('descendant-or-self::h1'); + * $value = $I->grabTextFrom('~ + * ``` + * + * @param $cssOrXPathOrRegex + * + * @return mixed + * @see \Codeception\Lib\InnerBrowser::grabTextFrom() + */ + public function grabTextFrom($cssOrXPathOrRegex) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('grabTextFrom', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Grabs the value of the given attribute value from the given element. + * Fails if element is not found. + * + * ``` php + * grabAttributeFrom('#tooltip', 'title'); + * ?> + * ``` + * + * + * @param $cssOrXpath + * @param $attribute + * + * @return mixed + * @see \Codeception\Lib\InnerBrowser::grabAttributeFrom() + */ + public function grabAttributeFrom($cssOrXpath, $attribute) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('grabAttributeFrom', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Grabs either the text content, or attribute values, of nodes + * matched by $cssOrXpath and returns them as an array. + * + * ```html + * First + * Second + * Third + * ``` + * + * ```php + * grabMultiple('a'); + * + * // would return ['#first', '#second', '#third'] + * $aLinks = $I->grabMultiple('a', 'href'); + * ?> + * ``` + * + * @param $cssOrXpath + * @param $attribute + * @return string[] + * @see \Codeception\Lib\InnerBrowser::grabMultiple() + */ + public function grabMultiple($cssOrXpath, $attribute = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('grabMultiple', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * @param $field + * + * @return array|mixed|null|string + * @see \Codeception\Lib\InnerBrowser::grabValueFrom() + */ + public function grabValueFrom($field) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('grabValueFrom', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Sets a cookie with the given name and value. + * You can set additional cookie params like `domain`, `path`, `expires`, `secure` in array passed as last argument. + * + * ``` php + * setCookie('PHPSESSID', 'el4ukv0kqbvoirg7nkp4dncpk3'); + * ?> + * ``` + * + * @param $name + * @param $val + * @param array $params + * + * @return mixed + * @see \Codeception\Lib\InnerBrowser::setCookie() + */ + public function setCookie($name, $val, $params = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('setCookie', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Grabs a cookie value. + * You can set additional cookie params like `domain`, `path` in array passed as last argument. + * + * @param $cookie + * + * @param array $params + * @return mixed + * @see \Codeception\Lib\InnerBrowser::grabCookie() + */ + public function grabCookie($cookie, $params = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('grabCookie', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that a cookie with the given name is set. + * You can set additional cookie params like `domain`, `path` as array passed in last argument. + * + * ``` php + * seeCookie('PHPSESSID'); + * ?> + * ``` + * + * @param $cookie + * @param array $params + * @return mixed + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeCookie() + */ + public function canSeeCookie($cookie, $params = null) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCookie', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that a cookie with the given name is set. + * You can set additional cookie params like `domain`, `path` as array passed in last argument. + * + * ``` php + * seeCookie('PHPSESSID'); + * ?> + * ``` + * + * @param $cookie + * @param array $params + * @return mixed + * @see \Codeception\Lib\InnerBrowser::seeCookie() + */ + public function seeCookie($cookie, $params = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCookie', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that there isn't a cookie with the given name. + * You can set additional cookie params like `domain`, `path` as array passed in last argument. + * + * @param $cookie + * + * @param array $params + * @return mixed + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeCookie() + */ + public function cantSeeCookie($cookie, $params = null) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCookie', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that there isn't a cookie with the given name. + * You can set additional cookie params like `domain`, `path` as array passed in last argument. + * + * @param $cookie + * + * @param array $params + * @return mixed + * @see \Codeception\Lib\InnerBrowser::dontSeeCookie() + */ + public function dontSeeCookie($cookie, $params = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCookie', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Unsets cookie with the given name. + * You can set additional cookie params like `domain`, `path` in array passed as last argument. + * + * @param $cookie + * + * @param array $params + * @return mixed + * @see \Codeception\Lib\InnerBrowser::resetCookie() + */ + public function resetCookie($name, $params = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('resetCookie', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the given element exists on the page and is visible. + * You can also specify expected attributes of this element. + * + * ``` php + * seeElement('.error'); + * $I->seeElement('//form/input[1]'); + * $I->seeElement('input', ['name' => 'login']); + * $I->seeElement('input', ['value' => '123456']); + * + * // strict locator in first arg, attributes in second + * $I->seeElement(['css' => 'form input'], ['name' => 'login']); + * ?> + * ``` + * + * @param $selector + * @param array $attributes + * @return + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeElement() + */ + public function canSeeElement($selector, $attributes = null) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeElement', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the given element exists on the page and is visible. + * You can also specify expected attributes of this element. + * + * ``` php + * seeElement('.error'); + * $I->seeElement('//form/input[1]'); + * $I->seeElement('input', ['name' => 'login']); + * $I->seeElement('input', ['value' => '123456']); + * + * // strict locator in first arg, attributes in second + * $I->seeElement(['css' => 'form input'], ['name' => 'login']); + * ?> + * ``` + * + * @param $selector + * @param array $attributes + * @return + * @see \Codeception\Lib\InnerBrowser::seeElement() + */ + public function seeElement($selector, $attributes = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeElement', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the given element is invisible or not present on the page. + * You can also specify expected attributes of this element. + * + * ``` php + * dontSeeElement('.error'); + * $I->dontSeeElement('//form/input[1]'); + * $I->dontSeeElement('input', ['name' => 'login']); + * $I->dontSeeElement('input', ['value' => '123456']); + * ?> + * ``` + * + * @param $selector + * @param array $attributes + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeElement() + */ + public function cantSeeElement($selector, $attributes = null) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeElement', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the given element is invisible or not present on the page. + * You can also specify expected attributes of this element. + * + * ``` php + * dontSeeElement('.error'); + * $I->dontSeeElement('//form/input[1]'); + * $I->dontSeeElement('input', ['name' => 'login']); + * $I->dontSeeElement('input', ['value' => '123456']); + * ?> + * ``` + * + * @param $selector + * @param array $attributes + * @see \Codeception\Lib\InnerBrowser::dontSeeElement() + */ + public function dontSeeElement($selector, $attributes = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeElement', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that there are a certain number of elements matched by the given locator on the page. + * + * ``` php + * seeNumberOfElements('tr', 10); + * $I->seeNumberOfElements('tr', [0,10]); //between 0 and 10 elements + * ?> + * ``` + * @param $selector + * @param mixed $expected : + * - string: strict number + * - array: range of numbers [0,10] + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeNumberOfElements() + */ + public function canSeeNumberOfElements($selector, $expected) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeNumberOfElements', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that there are a certain number of elements matched by the given locator on the page. + * + * ``` php + * seeNumberOfElements('tr', 10); + * $I->seeNumberOfElements('tr', [0,10]); //between 0 and 10 elements + * ?> + * ``` + * @param $selector + * @param mixed $expected : + * - string: strict number + * - array: range of numbers [0,10] + * @see \Codeception\Lib\InnerBrowser::seeNumberOfElements() + */ + public function seeNumberOfElements($selector, $expected) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeNumberOfElements', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the given option is selected. + * + * ``` php + * seeOptionIsSelected('#form input[name=payment]', 'Visa'); + * ?> + * ``` + * + * @param $selector + * @param $optionText + * + * @return mixed + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeOptionIsSelected() + */ + public function canSeeOptionIsSelected($selector, $optionText) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeOptionIsSelected', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the given option is selected. + * + * ``` php + * seeOptionIsSelected('#form input[name=payment]', 'Visa'); + * ?> + * ``` + * + * @param $selector + * @param $optionText + * + * @return mixed + * @see \Codeception\Lib\InnerBrowser::seeOptionIsSelected() + */ + public function seeOptionIsSelected($selector, $optionText) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeOptionIsSelected', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the given option is not selected. + * + * ``` php + * dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); + * ?> + * ``` + * + * @param $selector + * @param $optionText + * + * @return mixed + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeOptionIsSelected() + */ + public function cantSeeOptionIsSelected($selector, $optionText) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeOptionIsSelected', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the given option is not selected. + * + * ``` php + * dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); + * ?> + * ``` + * + * @param $selector + * @param $optionText + * + * @return mixed + * @see \Codeception\Lib\InnerBrowser::dontSeeOptionIsSelected() + */ + public function dontSeeOptionIsSelected($selector, $optionText) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeOptionIsSelected', func_get_args())); + } + + + /** + * [!] 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\Lib\InnerBrowser::seePageNotFound() + */ + public function canSeePageNotFound() { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seePageNotFound', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that current page has 404 response status code. + * @see \Codeception\Lib\InnerBrowser::seePageNotFound() + */ + public function seePageNotFound() { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seePageNotFound', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that response code is equal to value provided. + * + * ```php + * seeResponseCodeIs(200); + * + * // recommended \Codeception\Util\HttpCode + * $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK); + * ``` + * + * @param $code + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeResponseCodeIs() + */ + public function canSeeResponseCodeIs($code) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIs', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that response code is equal to value provided. + * + * ```php + * seeResponseCodeIs(200); + * + * // recommended \Codeception\Util\HttpCode + * $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK); + * ``` + * + * @param $code + * @see \Codeception\Lib\InnerBrowser::seeResponseCodeIs() + */ + public function seeResponseCodeIs($code) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIs', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that response code is equal to value provided. + * + * ```php + * dontSeeResponseCodeIs(200); + * + * // recommended \Codeception\Util\HttpCode + * $I->dontSeeResponseCodeIs(\Codeception\Util\HttpCode::OK); + * ``` + * @param $code + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeResponseCodeIs() + */ + public function cantSeeResponseCodeIs($code) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeResponseCodeIs', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that response code is equal to value provided. + * + * ```php + * dontSeeResponseCodeIs(200); + * + * // recommended \Codeception\Util\HttpCode + * $I->dontSeeResponseCodeIs(\Codeception\Util\HttpCode::OK); + * ``` + * @param $code + * @see \Codeception\Lib\InnerBrowser::dontSeeResponseCodeIs() + */ + public function dontSeeResponseCodeIs($code) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeResponseCodeIs', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the page title contains the given string. + * + * ``` php + * seeInTitle('Blog - Post #1'); + * ?> + * ``` + * + * @param $title + * + * @return mixed + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeInTitle() + */ + public function canSeeInTitle($title) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInTitle', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the page title contains the given string. + * + * ``` php + * seeInTitle('Blog - Post #1'); + * ?> + * ``` + * + * @param $title + * + * @return mixed + * @see \Codeception\Lib\InnerBrowser::seeInTitle() + */ + public function seeInTitle($title) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInTitle', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the page title does not contain the given string. + * + * @param $title + * + * @return mixed + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeInTitle() + */ + public function cantSeeInTitle($title) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInTitle', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the page title does not contain the given string. + * + * @param $title + * + * @return mixed + * @see \Codeception\Lib\InnerBrowser::dontSeeInTitle() + */ + public function dontSeeInTitle($title) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInTitle', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Switch to iframe or frame on the page. + * + * Example: + * ``` html + *