Close #41 remove deprecated package yii2-codeception. Update tests.

This commit is contained in:
Antonio Ramirez
2017-08-06 15:29:36 +02:00
parent 026a6e9825
commit fcdb228c41
18 changed files with 250 additions and 478 deletions

View File

@ -57,7 +57,6 @@
"friendsofphp/php-cs-fixer": "^2.3",
"squizlabs/php_codesniffer": "*",
"phpmd/phpmd": "@stable",
"yiisoft/yii2-codeception": "^2.0.0",
"codeception/specify": "^0.4.3",
"codeception/verify": "^0.3.1",
"codeception/codeception": "*"

258
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "f56bcec678e47fb82f7e5bf0e54b7ce0",
"content-hash": "7e91781cb2ad9f77a316c4b6fb24c837",
"packages": [
{
"name": "2amigos/yii2-selectize-widget",
@ -408,16 +408,16 @@
},
{
"name": "cebe/markdown",
"version": "1.1.1",
"version": "1.1.2",
"source": {
"type": "git",
"url": "https://github.com/cebe/markdown.git",
"reference": "c30eb5e01fe021cc5bba2f9ee0eeef96d4931166"
"reference": "25b28bae8a6f185b5030673af77b32e1163d5c6e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/cebe/markdown/zipball/c30eb5e01fe021cc5bba2f9ee0eeef96d4931166",
"reference": "c30eb5e01fe021cc5bba2f9ee0eeef96d4931166",
"url": "https://api.github.com/repos/cebe/markdown/zipball/25b28bae8a6f185b5030673af77b32e1163d5c6e",
"reference": "25b28bae8a6f185b5030673af77b32e1163d5c6e",
"shasum": ""
},
"require": {
@ -464,7 +464,7 @@
"markdown",
"markdown-extra"
],
"time": "2016-09-14T20:40:20+00:00"
"time": "2017-07-16T21:13:23+00:00"
},
{
"name": "ezyang/htmlpurifier",
@ -1407,16 +1407,16 @@
},
{
"name": "friendsofphp/php-cs-fixer",
"version": "v2.3.2",
"version": "v2.4.0",
"source": {
"type": "git",
"url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git",
"reference": "597745f744bcce1aed59dfd1bb4603de2a06cda9"
"reference": "63661f3add3609e90e4ab8115113e189ae547bb4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/597745f744bcce1aed59dfd1bb4603de2a06cda9",
"reference": "597745f744bcce1aed59dfd1bb4603de2a06cda9",
"url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/63661f3add3609e90e4ab8115113e189ae547bb4",
"reference": "63661f3add3609e90e4ab8115113e189ae547bb4",
"shasum": ""
},
"require": {
@ -1432,25 +1432,22 @@
"symfony/finder": "^3.0",
"symfony/options-resolver": "^3.0",
"symfony/polyfill-php70": "^1.0",
"symfony/polyfill-xml": "^1.3",
"symfony/polyfill-php72": "^1.4",
"symfony/process": "^3.0",
"symfony/stopwatch": "^3.0"
},
"conflict": {
"hhvm": "<3.18"
"hhvm": "*"
},
"require-dev": {
"johnkary/phpunit-speedtrap": "^1.1",
"justinrainbow/json-schema": "^5.0",
"mi-schi/phpmd-extension": "^4.2",
"phpmd/phpmd": "^2.4.3",
"phpunit/phpunit": "^4.8.35 || ^5.4.3",
"satooshi/php-coveralls": "^1.0",
"symfony/phpunit-bridge": "^3.2.2"
},
"suggest": {
"ext-mbstring": "For handling non-UTF8 characters in cache signature.",
"ext-xml": "For better performance.",
"symfony/polyfill-mbstring": "When enabling `ext-mbstring` is not possible."
},
"bin": [
@ -1459,13 +1456,20 @@
"type": "application",
"extra": {
"branch-alias": {
"dev-master": "2.3-dev"
"dev-master": "2.4-dev"
}
},
"autoload": {
"psr-4": {
"PhpCsFixer\\": "src/"
}
},
"classmap": [
"tests/Test/Assert/AssertTokensTrait.php",
"tests/Test/AbstractFixerTestCase.php",
"tests/Test/AbstractIntegrationTestCase.php",
"tests/Test/IntegrationCase.php",
"tests/Test/IntegrationCaseFactory.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -1482,7 +1486,7 @@
}
],
"description": "A tool to automatically fix PHP code style",
"time": "2017-05-24T21:59:38+00:00"
"time": "2017-07-18T15:35:40+00:00"
},
{
"name": "gecko-packages/gecko-php-unit",
@ -1890,22 +1894,22 @@
},
{
"name": "phpdocumentor/reflection-docblock",
"version": "3.2.0",
"version": "3.2.1",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
"reference": "46f7e8bb075036c92695b15a1ddb6971c751e585"
"reference": "183824db76118b9dddffc7e522b91fa175f75119"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/46f7e8bb075036c92695b15a1ddb6971c751e585",
"reference": "46f7e8bb075036c92695b15a1ddb6971c751e585",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/183824db76118b9dddffc7e522b91fa175f75119",
"reference": "183824db76118b9dddffc7e522b91fa175f75119",
"shasum": ""
},
"require": {
"php": ">=5.5",
"phpdocumentor/reflection-common": "^1.0@dev",
"phpdocumentor/type-resolver": "^0.4.0",
"phpdocumentor/type-resolver": "^0.3.0",
"webmozart/assert": "^1.0"
},
"require-dev": {
@ -1931,20 +1935,20 @@
}
],
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
"time": "2017-07-15T11:38:20+00:00"
"time": "2017-08-04T20:55:59+00:00"
},
{
"name": "phpdocumentor/type-resolver",
"version": "0.4.0",
"version": "0.3.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/TypeResolver.git",
"reference": "9c977708995954784726e25d0cd1dddf4e65b0f7"
"reference": "fb3933512008d8162b3cdf9e18dba9309b7c3773"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7",
"reference": "9c977708995954784726e25d0cd1dddf4e65b0f7",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/fb3933512008d8162b3cdf9e18dba9309b7c3773",
"reference": "fb3933512008d8162b3cdf9e18dba9309b7c3773",
"shasum": ""
},
"require": {
@ -1978,7 +1982,7 @@
"email": "me@mikevanriel.com"
}
],
"time": "2017-07-14T14:27:02+00:00"
"time": "2017-06-03T08:32:36+00:00"
},
{
"name": "phpmd/phpmd",
@ -3160,16 +3164,16 @@
},
{
"name": "squizlabs/php_codesniffer",
"version": "3.0.1",
"version": "3.0.2",
"source": {
"type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
"reference": "f9eaf037edf22fdfccf04cb0ab57ebcb1e166219"
"reference": "c7594a88ae75401e8f8d0bd4deb8431b39045c51"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/f9eaf037edf22fdfccf04cb0ab57ebcb1e166219",
"reference": "f9eaf037edf22fdfccf04cb0ab57ebcb1e166219",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/c7594a88ae75401e8f8d0bd4deb8431b39045c51",
"reference": "c7594a88ae75401e8f8d0bd4deb8431b39045c51",
"shasum": ""
},
"require": {
@ -3207,7 +3211,7 @@
"phpcs",
"standards"
],
"time": "2017-06-14T01:23:49+00:00"
"time": "2017-07-18T01:12:32+00:00"
},
{
"name": "stecman/symfony-console-completion",
@ -3256,16 +3260,16 @@
},
{
"name": "symfony/browser-kit",
"version": "v3.3.4",
"version": "v3.3.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/browser-kit.git",
"reference": "3a4435e79a8401746e8525e98039199d0924b4e5"
"reference": "8079a6b3668ef15cdbf73a4c7d31081abb8bb5f0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/browser-kit/zipball/3a4435e79a8401746e8525e98039199d0924b4e5",
"reference": "3a4435e79a8401746e8525e98039199d0924b4e5",
"url": "https://api.github.com/repos/symfony/browser-kit/zipball/8079a6b3668ef15cdbf73a4c7d31081abb8bb5f0",
"reference": "8079a6b3668ef15cdbf73a4c7d31081abb8bb5f0",
"shasum": ""
},
"require": {
@ -3309,20 +3313,20 @@
],
"description": "Symfony BrowserKit Component",
"homepage": "https://symfony.com",
"time": "2017-06-24T09:29:48+00:00"
"time": "2017-07-12T13:03:20+00:00"
},
{
"name": "symfony/config",
"version": "v3.3.4",
"version": "v3.3.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/config.git",
"reference": "a094618deb9a3fe1c3cf500a796e167d0495a274"
"reference": "54ee12b0dd60f294132cabae6f5da9573d2e5297"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/config/zipball/a094618deb9a3fe1c3cf500a796e167d0495a274",
"reference": "a094618deb9a3fe1c3cf500a796e167d0495a274",
"url": "https://api.github.com/repos/symfony/config/zipball/54ee12b0dd60f294132cabae6f5da9573d2e5297",
"reference": "54ee12b0dd60f294132cabae6f5da9573d2e5297",
"shasum": ""
},
"require": {
@ -3371,20 +3375,20 @@
],
"description": "Symfony Config Component",
"homepage": "https://symfony.com",
"time": "2017-06-16T12:40:34+00:00"
"time": "2017-07-19T07:37:29+00:00"
},
{
"name": "symfony/console",
"version": "v3.3.4",
"version": "v3.3.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "a97e45d98c59510f085fa05225a1acb74dfe0546"
"reference": "b0878233cb5c4391347e5495089c7af11b8e6201"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/a97e45d98c59510f085fa05225a1acb74dfe0546",
"reference": "a97e45d98c59510f085fa05225a1acb74dfe0546",
"url": "https://api.github.com/repos/symfony/console/zipball/b0878233cb5c4391347e5495089c7af11b8e6201",
"reference": "b0878233cb5c4391347e5495089c7af11b8e6201",
"shasum": ""
},
"require": {
@ -3440,11 +3444,11 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
"time": "2017-07-03T13:19:36+00:00"
"time": "2017-07-29T21:27:59+00:00"
},
{
"name": "symfony/css-selector",
"version": "v3.3.4",
"version": "v3.3.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/css-selector.git",
@ -3497,16 +3501,16 @@
},
{
"name": "symfony/debug",
"version": "v3.3.4",
"version": "v3.3.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/debug.git",
"reference": "63b85a968486d95ff9542228dc2e4247f16f9743"
"reference": "7c13ae8ce1e2adbbd574fc39de7be498e1284e13"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/debug/zipball/63b85a968486d95ff9542228dc2e4247f16f9743",
"reference": "63b85a968486d95ff9542228dc2e4247f16f9743",
"url": "https://api.github.com/repos/symfony/debug/zipball/7c13ae8ce1e2adbbd574fc39de7be498e1284e13",
"reference": "7c13ae8ce1e2adbbd574fc39de7be498e1284e13",
"shasum": ""
},
"require": {
@ -3549,20 +3553,20 @@
],
"description": "Symfony Debug Component",
"homepage": "https://symfony.com",
"time": "2017-07-05T13:02:37+00:00"
"time": "2017-07-28T15:27:31+00:00"
},
{
"name": "symfony/dependency-injection",
"version": "v3.3.4",
"version": "v3.3.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/dependency-injection.git",
"reference": "986a633c92220ecb22ad06820a1df126c7a4f9eb"
"reference": "8d70987f991481e809c63681ffe8ce3f3fde68a0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/dependency-injection/zipball/986a633c92220ecb22ad06820a1df126c7a4f9eb",
"reference": "986a633c92220ecb22ad06820a1df126c7a4f9eb",
"url": "https://api.github.com/repos/symfony/dependency-injection/zipball/8d70987f991481e809c63681ffe8ce3f3fde68a0",
"reference": "8d70987f991481e809c63681ffe8ce3f3fde68a0",
"shasum": ""
},
"require": {
@ -3619,11 +3623,11 @@
],
"description": "Symfony DependencyInjection Component",
"homepage": "https://symfony.com",
"time": "2017-06-20T14:01:46+00:00"
"time": "2017-07-28T15:27:31+00:00"
},
{
"name": "symfony/dom-crawler",
"version": "v3.3.4",
"version": "v3.3.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/dom-crawler.git",
@ -3679,7 +3683,7 @@
},
{
"name": "symfony/event-dispatcher",
"version": "v3.3.4",
"version": "v3.3.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
@ -3742,16 +3746,16 @@
},
{
"name": "symfony/filesystem",
"version": "v3.3.4",
"version": "v3.3.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
"reference": "311fa718389efbd8b627c272b9324a62437018cc"
"reference": "427987eb4eed764c3b6e38d52a0f87989e010676"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/311fa718389efbd8b627c272b9324a62437018cc",
"reference": "311fa718389efbd8b627c272b9324a62437018cc",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/427987eb4eed764c3b6e38d52a0f87989e010676",
"reference": "427987eb4eed764c3b6e38d52a0f87989e010676",
"shasum": ""
},
"require": {
@ -3787,11 +3791,11 @@
],
"description": "Symfony Filesystem Component",
"homepage": "https://symfony.com",
"time": "2017-06-24T09:29:48+00:00"
"time": "2017-07-11T07:17:58+00:00"
},
{
"name": "symfony/finder",
"version": "v3.3.4",
"version": "v3.3.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
@ -3840,7 +3844,7 @@
},
{
"name": "symfony/options-resolver",
"version": "v3.3.4",
"version": "v3.3.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/options-resolver.git",
@ -4065,66 +4069,18 @@
],
"time": "2017-06-09T08:25:21+00:00"
},
{
"name": "symfony/polyfill-xml",
"version": "v1.4.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-xml.git",
"reference": "89326af9d173053826ae8fe26a6f49597ba4e9f3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-xml/zipball/89326af9d173053826ae8fe26a6f49597ba4e9f3",
"reference": "89326af9d173053826ae8fe26a6f49597ba4e9f3",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"symfony/polyfill-php72": "~1.4"
},
"type": "metapackage",
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for xml's utf8_encode and utf8_decode functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
],
"time": "2017-06-09T08:25:21+00:00"
},
{
"name": "symfony/process",
"version": "v3.3.4",
"version": "v3.3.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "5ab8949b682b1bf9d4511a228b5e045c96758c30"
"reference": "07432804942b9f6dd7b7377faf9920af5f95d70a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/5ab8949b682b1bf9d4511a228b5e045c96758c30",
"reference": "5ab8949b682b1bf9d4511a228b5e045c96758c30",
"url": "https://api.github.com/repos/symfony/process/zipball/07432804942b9f6dd7b7377faf9920af5f95d70a",
"reference": "07432804942b9f6dd7b7377faf9920af5f95d70a",
"shasum": ""
},
"require": {
@ -4160,11 +4116,11 @@
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
"time": "2017-07-03T08:12:02+00:00"
"time": "2017-07-13T13:05:09+00:00"
},
{
"name": "symfony/stopwatch",
"version": "v3.3.4",
"version": "v3.3.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/stopwatch.git",
@ -4213,16 +4169,16 @@
},
{
"name": "symfony/yaml",
"version": "v3.3.4",
"version": "v3.3.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "1f93a8d19b8241617f5074a123e282575b821df8"
"reference": "ddc23324e6cfe066f3dd34a37ff494fa80b617ed"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/1f93a8d19b8241617f5074a123e282575b821df8",
"reference": "1f93a8d19b8241617f5074a123e282575b821df8",
"url": "https://api.github.com/repos/symfony/yaml/zipball/ddc23324e6cfe066f3dd34a37ff494fa80b617ed",
"reference": "ddc23324e6cfe066f3dd34a37ff494fa80b617ed",
"shasum": ""
},
"require": {
@ -4264,7 +4220,7 @@
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"time": "2017-06-15T12:58:50+00:00"
"time": "2017-07-23T12:43:26+00:00"
},
{
"name": "webmozart/assert",
@ -4315,52 +4271,6 @@
"validate"
],
"time": "2016-11-23T20:04:58+00:00"
},
{
"name": "yiisoft/yii2-codeception",
"version": "2.0.6",
"source": {
"type": "git",
"url": "https://github.com/yiisoft/yii2-codeception.git",
"reference": "086c8c2d28736e7a484a7a8611b5cc84024e9fb3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/yiisoft/yii2-codeception/zipball/086c8c2d28736e7a484a7a8611b5cc84024e9fb3",
"reference": "086c8c2d28736e7a484a7a8611b5cc84024e9fb3",
"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"
],
"abandoned": "codeception/codeception",
"time": "2017-05-22T12:08:21+00:00"
}
],
"aliases": [],

View File

@ -1,16 +0,0 @@
<?php
namespace tests\_pages;
use yii\codeception\BasePage;
/**
* Represents admin page.
*
* @property \FunctionalTester $actor
*/
class AdminPage extends BasePage
{
/** {@inheritdoc} */
public $route = '/user/admin/index';
}

View File

@ -1,29 +0,0 @@
<?php
namespace tests\_pages;
use yii\codeception\BasePage;
/**
* Represents admin create page.
*
* @property \FunctionalTester $actor
*/
class CreatePage extends BasePage
{
/** {@inheritdoc} */
public $route = '/user/admin/create';
/**
* @param $username
* @param $email
* @param $password
*/
public function create($username, $email, $password)
{
$this->actor->fillField('#user-username', $username);
$this->actor->fillField('#user-email', $email);
$this->actor->fillField('#user-password', $password);
$this->actor->click('Save');
}
}

View File

@ -1,27 +0,0 @@
<?php
namespace tests\_pages;
use yii\codeception\BasePage;
/**
* Represents login page.
*
* @property \FunctionalTester $actor
*/
class LoginPage extends BasePage
{
/** {@inheritdoc} */
public $route = '/user/security/login';
/**
* @param $login
* @param $password
*/
public function login($login, $password)
{
$this->actor->fillField('#loginform-login', $login);
$this->actor->fillField('#loginform-password', $password);
$this->actor->click('Sign in');
}
}

View File

@ -1,25 +0,0 @@
<?php
namespace tests\_pages;
use yii\codeception\BasePage;
/**
* Represents resend page.
*
* @property \FunctionalTester $actor
*/
class RecoveryPage extends BasePage
{
/** {@inheritdoc} */
public $route = '/user/recovery/request';
/**
* @param $email
*/
public function recover($email)
{
$this->actor->fillField('#recoveryform-email', $email);
$this->actor->click('Continue');
}
}

View File

@ -1,31 +0,0 @@
<?php
namespace tests\_pages;
use yii\codeception\BasePage;
/**
* Represents registration page.
*
* @property \FunctionalTester $actor
*/
class RegistrationPage extends BasePage
{
/** {@inheritdoc} */
public $route = '/user/registration/register';
/**
* @param $username
* @param $email
* @param $password
*/
public function register($email, $username = null, $password = null)
{
$this->actor->fillField('#registrationform-email', $email);
$this->actor->fillField('#registrationform-username', $username);
if ($password !== null) {
$this->actor->fillField('#registrationform-password', $password);
}
$this->actor->click('Sign up');
}
}

View File

@ -1,25 +0,0 @@
<?php
namespace tests\_pages;
use yii\codeception\BasePage;
/**
* Represents resend page.
*
* @property \FunctionalTester $actor
*/
class ResendPage extends BasePage
{
/** {@inheritdoc} */
public $route = '/user/registration/resend';
/**
* @param $email
*/
public function resend($email)
{
$this->actor->fillField('#resendform-email', $email);
$this->actor->click('Continue');
}
}

View File

@ -1,31 +0,0 @@
<?php
namespace tests\_pages;
use yii\codeception\BasePage;
/**
* Represents email settings page.
*
* @property \FunctionalTester $actor
*/
class SettingsPage extends BasePage
{
/** {@inheritdoc} */
public $route = '/user/settings/account';
/**
* @param $email
* @param $username
* @param null $password
* @param $currentPassword
*/
public function update($email, $username, $currentPassword, $password = null)
{
$this->actor->fillField('#settingsform-email', $email);
$this->actor->fillField('#settingsform-username', $username);
$this->actor->fillField('#settingsform-new_password', $password);
$this->actor->fillField('#settingsform-current_password', $currentPassword);
$this->actor->click('Save');
}
}

View File

@ -1,29 +0,0 @@
<?php
namespace tests\_pages;
use yii\codeception\BasePage;
/**
* Represents admin update page.
*
* @property \FunctionalTester $actor
*/
class UpdatePage extends BasePage
{
/** {@inheritdoc} */
public $route = '/user/admin/update';
/**
* @param $username
* @param $email
* @param $password
*/
public function update($username, $email, $password = null)
{
$this->actor->fillField('#user-username', $username);
$this->actor->fillField('#user-email', $email);
$this->actor->fillField('#user-password', $password);
$this->actor->click('Update');
}
}

View File

@ -3,8 +3,8 @@
/**
* @var Codeception\Scenario
*/
use tests\_fixtures\TokenFixture;
use yii\helpers\Url;
$I = new FunctionalTester($scenario);
$I->wantTo('ensure that confirmation works');
@ -12,11 +12,11 @@ $I->haveFixtures(['token' => TokenFixture::className()]);
$I->amGoingTo('check that error is showed when token expired');
$token = $I->grabFixture('token', 'expired_confirmation');
$I->amOnPage(Url::toRoute(['/user/registration/confirm', 'id' => $token->user_id, 'code' => $token->code]));
$I->amOnRoute('/user/registration/confirm', ['id' => $token->user_id, 'code' => $token->code]);
$I->see('The confirmation link is invalid or expired. Please try requesting a new one.');
$I->amGoingTo('check that user get confirmed');
$token = $I->grabFixture('token', 'confirmation');
$I->amOnPage(Url::toRoute(['/user/registration/confirm', 'id' => $token->user_id, 'code' => $token->code]));
$I->amOnRoute('/user/registration/confirm', ['id' => $token->user_id, 'code' => $token->code]);
$I->see('Thank you, registration is now complete.');
$I->see('Logout');

View File

@ -3,29 +3,38 @@
/**
* @var Codeception\Scenario
*/
use tests\_fixtures\UserFixture;
use tests\_pages\CreatePage;
use tests\_pages\LoginPage;
$I = new FunctionalTester($scenario);
$I->wantTo('ensure that user creation works');
$I->haveFixtures(['user' => UserFixture::className()]);
$loginPage = LoginPage::openBy($I);
$user = $I->grabFixture('user', 'user');
$loginPage->login($user->email, 'qwerty');
$page = CreatePage::openBy($I);
$I->amLoggedInAs($user);
$I->amOnRoute('/user/admin/create');
$I->amGoingTo('try to create user with empty fields');
$page->create('', '', '');
$I->fillField('#user-username', '');
$I->fillField('#user-email', '');
$I->fillField('#user-password', '');
$I->click('Save');
$I->expectTo('see validations errors');
$I->see('Username cannot be blank.');
$I->see('Email cannot be blank.');
$page->create('foobar', 'foobar@example.com', 'foobar');
$I->fillField('#user-username', 'foobar');
$I->fillField('#user-email', 'foobar@example.com');
$I->fillField('#user-password', 'foobar');
$I->click('Save');
$I->see('User has been created');
Yii::$app->user->logout();
LoginPage::openBy($I)->login('foobar@example.com', 'foobar');
$I->amOnRoute('/user/security/login');
$I->fillField('#loginform-login', 'foobar@example.com');
$I->fillField('#loginform-password', 'foobar');
$I->click('Sign in');
$I->see('Logout');

View File

@ -3,38 +3,50 @@
/**
* @var Codeception\Scenario
*/
use tests\_fixtures\UserFixture;
use tests\_pages\LoginPage;
$I = new FunctionalTester($scenario);
$I->wantTo('ensure that login works');
$I->haveFixtures(['user' => UserFixture::className()]);
$page = LoginPage::openBy($I);
$I->amOnRoute('/user/security/login');
$I->amGoingTo('try to login with empty credentials');
$page->login('', '');
$I->fillField('#loginform-login', '');
$I->fillField('#loginform-password', '');
$I->click('Sign in');
$I->expectTo('see validations errors');
$I->see('Login cannot be blank.');
$I->see('Password cannot be blank.');
$I->amGoingTo('try to login with unconfirmed account');
$user = $I->grabFixture('user', 'unconfirmed');
$page->login($user->email, 'qwerty');
$I->fillField('#loginform-login', $user->email);
$I->fillField('#loginform-password', 'qwerty');
$I->click('Sign in');
$I->expectTo('see validations errors');
$I->see('You need to confirm your email address');
$I->amGoingTo('try to login with blocked account');
$user = $I->grabFixture('user', 'blocked');
$page->login($user->email, 'qwerty');
$I->fillField('#loginform-login', $user->email);
$I->fillField('#loginform-password', 'qwerty');
$I->click('Sign in');
$I->expectTo('see blocking information');
$I->see('Your account has been blocked');
$I->amGoingTo('try to login with wrong credentials');
$user = $I->grabFixture('user', 'user');
$page->login($user->email, 'wrong');
$I->fillField('#loginform-login', $user->email);
$I->fillField('#loginform-password', 'wrong');
$I->click('Sign in');
$I->expectTo('see validations errors');
$I->see('Invalid login or password');
$I->amGoingTo('try to login with correct credentials');
$page->login($user->email, 'qwerty');
$I->fillField('#loginform-login', $user->email);
$I->fillField('#loginform-password', 'qwerty');
$I->click('Sign in');
$I->dontSee('Login');
$I->see('Logout');

View File

@ -3,53 +3,64 @@
/**
* @var Codeception\Scenario
*/
use Da\User\Model\Token;
use Da\User\Model\User;
use tests\_fixtures\TokenFixture;
use tests\_fixtures\UserFixture;
use tests\_pages\RecoveryPage;
use tests\_pages\LoginPage;
use yii\helpers\Html;
use yii\helpers\Url;
use Da\User\Model\User;
use Da\User\Model\Token;
$I = new FunctionalTester($scenario);
$I->wantTo('ensure that password recovery works');
$I->haveFixtures(['user' => UserFixture::className(), 'token' => TokenFixture::className()]);
$I->amGoingTo('try to request recovery token for unconfirmed account');
$page = RecoveryPage::openBy($I);
$I->amOnRoute('/user/recovery/request');
$user = $I->grabFixture('user', 'unconfirmed');
$page->recover($user->email);
$I->fillField('#recoveryform-email', $user->email);
$I->click('Continue');
$I->see('An email has been sent with instructions for resetting your password');
$I->amGoingTo('try to request recovery token');
$page = RecoveryPage::openBy($I);
$I->amOnRoute('/user/recovery/request');
$user = $I->grabFixture('user', 'user');
$page->recover($user->email);
$I->fillField('#recoveryform-email', $user->email);
$I->click('Continue');
$I->see('An email has been sent with instructions for resetting your password');
$user = $I->grabRecord(User::className(), ['email' => $user->email]);
$token = $I->grabRecord(Token::className(), ['user_id' => $user->id, 'type' => Token::TYPE_RECOVERY]);
/** @var yii\swiftmailer\Message $message */
$message = $I->grabLastSentEmail();
//$I->assertArrayHasKey($user->email, $message->getTo());
//$I->assertContains(Html::encode($token->getUrl()), utf8_encode(quoted_printable_decode($message->getSwiftMessage()->toString())));
$I->assertArrayHasKey($user->email, $message->getTo());
$I->assertContains(
Html::encode($token->getUrl()),
utf8_encode(quoted_printable_decode($message->getSwiftMessage()->toString()))
);
//$I->amGoingTo('reset password with invalid token');
//$user = $I->grabFixture('user', 'user_with_expired_recovery_token');
//$token = $I->grabRecord(Token::className(), ['user_id' => $user->id, 'type' => Token::TYPE_RECOVERY]);
//$I->amOnPage(Url::toRoute(['/user/recovery/reset', 'id' => $user->id, 'code' => $token->code]));
//$I->see('Recovery link is invalid or expired. Please try requesting a new one.');
$I->amGoingTo('reset password with invalid token');
$user = $I->grabFixture('user', 'user_with_expired_recovery_token');
$token = $I->grabRecord(Token::className(), ['user_id' => $user->id, 'type' => Token::TYPE_RECOVERY]);
$I->amOnRoute('/user/recovery/reset', ['id' => $user->id, 'code' => $token->code]);
$I->see('Recovery link is invalid or expired. Please try requesting a new one.');
//$I->amGoingTo('reset password');
//$user = $I->grabFixture('user', 'user_with_recovery_token');
//$token = $I->grabRecord(Token::className(), ['user_id' => $user->id, 'type' => Token::TYPE_RECOVERY]);
//$I->amOnPage(Url::toRoute(['/user/recovery/reset', 'id' => $user->id, 'code' => $token->code]));
//$I->fillField('#recoveryform-password', 'newpass');
//$I->click('Finish');
//$I->see('Your password has been changed successfully.');
$I->amGoingTo('reset password');
$user = $I->grabFixture('user', 'user_with_recovery_token');
$token = $I->grabRecord(Token::className(), ['user_id' => $user->id, 'type' => Token::TYPE_RECOVERY]);
$I->amOnRoute('/user/recovery/reset', ['id' => $user->id, 'code' => $token->code]);
$I->fillField('#recoveryform-password', 'newpassword');
$I->click('Finish');
//$page = LoginPage::openBy($I);
//$page->login($user->email, 'qwerty');
//$I->see('Invalid login or password');
//$page->login($user->email, 'newpass');
//$I->dontSee('Invalid login or password');
$I->amGoingTo('Login with old password');
$I->amOnRoute('/user/security/login');
$I->fillField('#loginform-login', $user->email);
$I->fillField('#loginform-password', 'qwerty');
$I->click('Sign in');
$I->see('Invalid login or password');
$I->amGoingTo('Login with new password');
$I->fillField('#loginform-login', $user->email);
$I->fillField('#loginform-password', 'newpassword');
$I->click('Sign in');
$I->see('Logout');

View File

@ -5,8 +5,6 @@ use Da\User\Model\Token;
use Da\User\Model\User;
use Da\User\Module;
use tests\_fixtures\UserFixture;
use tests\_pages\LoginPage;
use tests\_pages\RegistrationPage;
use yii\helpers\Html;
class RegistrationCest
@ -36,10 +34,10 @@ class RegistrationCest
'generatePasswords' => false,
]);
$page = RegistrationPage::openBy($I);
$I->amOnRoute('/user/registration/register');
$I->amGoingTo('try to register with empty credentials');
$page->register('', '', '');
$this->register($I, '', '', '');
$I->see('Username cannot be blank');
$I->see('Email cannot be blank');
$I->see('Password cannot be blank');
@ -47,17 +45,19 @@ class RegistrationCest
$I->amGoingTo('try to register with already used email and username');
$user = $I->grabFixture('user', 'user');
$page->register($user->email, $user->username, 'qwerty');
$this->register($I, $user->email, $user->username, 'qwerty');
$I->see(Html::encode('This username has already been taken'));
$I->see(Html::encode('This email address has already been taken'));
$page->register('tester@example.com', 'tester', 'tester');
$this->register($I, 'tester@example.com', 'tester', 'tester');
$I->see('Your account has been created and a message with further instructions has been sent to your email');
$user = $I->grabRecord(User::className(), ['email' => 'tester@example.com']);
$I->assertTrue($user->isConfirmed);
$page = LoginPage::openBy($I);
$page->login('tester', 'tester');
$I->amOnRoute('/user/security/login');
$I->fillField('#loginform-login', 'tester');
$I->fillField('#loginform-password', 'tester');
$I->click('Sign in');
$I->see('Logout');
}
@ -71,8 +71,8 @@ class RegistrationCest
\Yii::$container->set(Module::className(), [
'enableEmailConfirmation' => true,
]);
$page = RegistrationPage::openBy($I);
$page->register('tester@example.com', 'tester', 'tester');
$I->amOnRoute('/user/registration/register');
$this->register($I, 'tester@example.com', 'tester', 'tester');
$I->see('Your account has been created and a message with further instructions has been sent to your email');
$user = $I->grabRecord(User::className(), ['email' => 'tester@example.com']);
$token = $I->grabRecord(Token::className(), ['user_id' => $user->id, 'type' => Token::TYPE_CONFIRMATION]);
@ -94,8 +94,8 @@ class RegistrationCest
'enableEmailConfirmation' => false,
'generatePasswords' => true,
]);
$page = RegistrationPage::openBy($I);
$page->register('tester@example.com', 'tester');
$I->amOnRoute('/user/registration/register');
$this->register($I, 'tester@example.com', 'tester');
$I->see('Your account has been created and a message with further instructions has been sent to your email');
$user = $I->grabRecord(User::className(), ['email' => 'tester@example.com']);
$I->assertEquals('tester', $user->username);
@ -104,4 +104,14 @@ class RegistrationCest
$I->assertArrayHasKey($user->email, $message->getTo());
$I->assertContains('We have generated a password for you', utf8_encode(quoted_printable_decode($message->getSwiftMessage()->toString())));
}
protected function register(FunctionalTester $I, $email, $username = null, $password = null) {
$I->fillField('#registrationform-email', $email);
$I->fillField('#registrationform-username', $username);
if ($password !== null) {
$I->fillField('#registrationform-password', $password);
}
$I->click('Sign up');
}
}

View File

@ -3,26 +3,29 @@
/**
* @var Codeception\Scenario
*/
use tests\_fixtures\UserFixture;
use tests\_pages\ResendPage;
$I = new FunctionalTester($scenario);
$I->wantTo('ensure that resending of confirmation tokens works');
$I->haveFixtures(['user' => UserFixture::className()]);
$I->amGoingTo('try to resend token to non-existent user');
$page = ResendPage::openBy($I);
$page->resend('foo@example.com');
$I->amOnRoute('/user/registration/resend');
$I->fillField('#resendform-email', 'foo@example.com');
$I->click('Continue');
$I->see('We couldn\'t re-send the mail to confirm your address. Please, verify is the correct email or if it has been confirmed already.');
$I->amGoingTo('try to resend token to already confirmed user');
$page = ResendPage::openBy($I);
$I->amOnRoute('/user/registration/resend');
$user = $I->grabFixture('user', 'user');
$page->resend($user->email);
$I->fillField('#resendform-email', $user->email);
$I->click('Continue');
$I->see('We couldn\'t re-send the mail to confirm your address. Please, verify is the correct email or if it has been confirmed already.');
$I->amGoingTo('try to resend token to unconfirmed user');
$page = ResendPage::openBy($I);
$I->amOnRoute('/user/registration/resend');
$user = $I->grabFixture('user', 'unconfirmed');
$page->resend($user->email);
$I->fillField('#resendform-email', $user->email);
$I->click('Continue');
$I->see('A message has been sent to your email address. It contains a confirmation link that you must click to complete registration.');

View File

@ -3,31 +3,36 @@
/**
* @var Codeception\Scenario
*/
use Da\User\Model\Token;
use Da\User\Model\User;
use tests\_fixtures\ProfileFixture;
use tests\_fixtures\UserFixture;
use tests\_pages\LoginPage;
use tests\_pages\SettingsPage;
use yii\helpers\Html;
$I = new FunctionalTester($scenario);
$I->wantTo('ensure that account settings page work');
$I->haveFixtures(['user' => UserFixture::className(), 'profile' => ProfileFixture::className()]);
$page = LoginPage::openBy($I);
$user = $I->grabFixture('user', 'user');
$page->login($user->username, 'qwerty');
$I->amLoggedInAs($user);
$page = SettingsPage::openBy($I);
$I->amOnRoute('/user/settings/account');
$I->amGoingTo('check that current password is required and must be valid');
$page->update($user->email, $user->username, 'wrong');
$I->fillField('#settingsform-email', $user->email);
$I->fillField('#settingsform-username', $user->username);
$I->fillField('#settingsform-current_password', 'wrong');
$I->click('Save');
$I->see('Current password is not valid');
$I->amGoingTo('check that email is changing properly');
$page->update('new_user@example.com', $user->username, 'qwerty');
$I->fillField('#settingsform-email', 'new_user@example.com');
$I->fillField('#settingsform-username', $user->username);
$I->fillField('#settingsform-current_password', 'qwerty');
$I->click('Save');
$I->seeRecord(User::className(), ['email' => $user->email, 'unconfirmed_email' => 'new_user@example.com']);
$I->see('A confirmation message has been sent to your new email address');
$user = $I->grabRecord(User::className(), ['id' => $user->id]);
$token = $I->grabRecord(Token::className(), ['user_id' => $user->id, 'type' => Token::TYPE_CONFIRM_NEW_EMAIL]);
@ -35,12 +40,13 @@ $token = $I->grabRecord(Token::className(), ['user_id' => $user->id, 'type' => T
$message = $I->grabLastSentEmail();
$I->assertArrayHasKey($user->unconfirmed_email, $message->getTo());
$I->assertContains(Html::encode($token->getUrl()), utf8_encode(quoted_printable_decode($message->getSwiftMessage()->toString())));
Yii::$app->user->logout();
$I->amGoingTo('log in using new email address before clicking the confirmation link');
$page = LoginPage::openBy($I);
$page->login('new_user@example.com', 'qwerty');
$I->amOnRoute('/user/security/login');
$I->fillField('#loginform-login', 'new_user@example.com');
$I->fillField('#loginform-password', 'qwerty');
$I->click('Sign in');
$I->see('Invalid login or password');
$I->amGoingTo('log in using new email address after clicking the confirmation link');
@ -48,7 +54,9 @@ $I->amGoingTo('log in using new email address after clicking the confirmation li
$emailChangeService = Yii::createObject(\Da\User\Service\EmailChangeService::class, [$token->code, $user]);
$emailChangeService->run();
$page->login('new_user@example.com', 'qwerty');
$I->fillField('#loginform-login', 'new_user@example.com');
$I->fillField('#loginform-password', 'qwerty');
$I->click('Sign in');
$I->see('Logout');
$I->seeRecord(User::className(), [
'id' => 1,
@ -57,15 +65,26 @@ $I->seeRecord(User::className(), [
]);
$I->amGoingTo('reset email changing process');
$page = SettingsPage::openBy($I);
$page->update('user@example.com', $user->username, 'qwerty');
$I->amOnRoute('/user/settings/account');
$I->fillField('#settingsform-email', 'user@example.com');
$I->fillField('#settingsform-username', $user->username);
$I->fillField('#settingsform-new_password', null);
$I->fillField('#settingsform-current_password', 'qwerty');
$I->click('Save');
$I->see('A confirmation message has been sent to your new email address');
$I->seeRecord(User::className(), [
'id' => 1,
'email' => 'new_user@example.com',
'unconfirmed_email' => 'user@example.com',
]);
$page->update('new_user@example.com', $user->username, 'qwerty');
$I->fillField('#settingsform-email', 'new_user@example.com');
$I->fillField('#settingsform-username', $user->username);
$I->fillField('#settingsform-new_password', null);
$I->fillField('#settingsform-current_password', 'qwerty');
$I->click('Save');
$I->see('Your account details have been updated');
$I->seeRecord(User::className(), [
'id' => 1,
@ -73,7 +92,12 @@ $I->seeRecord(User::className(), [
'unconfirmed_email' => null,
]);
$I->amGoingTo('change username and password');
$page->update('new_user@example.com', 'nickname', 'qwerty', '123654');
$I->fillField('#settingsform-email', 'new_user@example.com');
$I->fillField('#settingsform-username', 'nickname');
$I->fillField('#settingsform-new_password', '123654');
$I->fillField('#settingsform-current_password', 'qwerty');
$I->click('Save');
$I->see('Your account details have been updated');
$I->seeRecord(User::className(), [
'username' => 'nickname',
@ -83,6 +107,8 @@ $I->seeRecord(User::className(), [
Yii::$app->user->logout();
$I->amGoingTo('login with new credentials');
$page = LoginPage::openBy($I);
$page->login('nickname', '123654');
$I->amOnRoute('/user/security/login');
$I->fillField('#loginform-login', 'new_user@example.com');
$I->fillField('#loginform-password', '123654');
$I->click('Sign in');
$I->see('Logout');

View File

@ -3,23 +3,28 @@
/**
* @var Codeception\Scenario
*/
use tests\_fixtures\UserFixture;
use tests\_pages\UpdatePage;
use tests\_pages\LoginPage;
$I = new FunctionalTester($scenario);
$I->wantTo('ensure that user update works');
$I->haveFixtures(['user' => UserFixture::className()]);
$loginPage = LoginPage::openBy($I);
$user = $I->grabFixture('user', 'user');
$loginPage->login($user->email, 'qwerty');
$I->amLoggedInAs($user);
$page = UpdatePage::openBy($I, ['id' => $user->id]);
$I->amOnRoute('/user/admin/update', ['id' => $user->id]);
$page->update('user', 'updated_user@example.com', 'new_pass');
$I->fillField('#user-username', 'user');
$I->fillField('#user-email', 'updated_user@example.com');
$I->fillField('#user-password', 'newpassword');
$I->click('Update');
$I->see('Account details have been updated');
Yii::$app->user->logout();
LoginPage::openBy($I)->login('updated_user@example.com', 'new_pass');
$I->amOnRoute('/user/security/login');
$I->fillField('#loginform-login', 'updated_user@example.com');
$I->fillField('#loginform-password', 'newpassword');
$I->click('Sign in');
$I->see('Logout');