added tests for amLoggedIn method
This commit is contained in:
parent
c6dd7c8790
commit
95bd8f4409
@ -20,7 +20,6 @@
|
|||||||
"yiisoft/yii2-swiftmailer": "*"
|
"yiisoft/yii2-swiftmailer": "*"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"codeception/base": "^2.2.3",
|
|
||||||
"codeception/verify": "*",
|
"codeception/verify": "*",
|
||||||
"yiisoft/yii2-debug": "*",
|
"yiisoft/yii2-debug": "*",
|
||||||
"yiisoft/yii2-gii": "*",
|
"yiisoft/yii2-gii": "*",
|
||||||
|
128
composer.lock
generated
128
composer.lock
generated
@ -4,8 +4,8 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"hash": "93894a180950d67c2b9edc7a95038f87",
|
"hash": "5a52c83f9793fadbf22499b59bdb56f9",
|
||||||
"content-hash": "c8959aaf297f5e79479a01ef1dd73b02",
|
"content-hash": "865dca284280bd582c54b70ef5cf23a6",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "bower-asset/bootstrap",
|
"name": "bower-asset/bootstrap",
|
||||||
@ -622,43 +622,6 @@
|
|||||||
"bower-asset-main": "dist/typeahead.bundle.js"
|
"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",
|
"name": "codeception/verify",
|
||||||
"version": "0.3.0",
|
"version": "0.3.0",
|
||||||
@ -740,48 +703,6 @@
|
|||||||
],
|
],
|
||||||
"time": "2016-04-29 12:21:54"
|
"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",
|
"name": "phpspec/php-diff",
|
||||||
"version": "v1.1.0",
|
"version": "v1.1.0",
|
||||||
@ -820,51 +741,6 @@
|
|||||||
"description": "A comprehensive library for generating differences between two hashable objects (strings or arrays).",
|
"description": "A comprehensive library for generating differences between two hashable objects (strings or arrays).",
|
||||||
"time": "2016-04-07 12:29:16"
|
"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",
|
"name": "yiisoft/yii2-debug",
|
||||||
"version": "2.0.6",
|
"version": "2.0.6",
|
||||||
|
@ -3,6 +3,4 @@ define('YII_ENV', 'test');
|
|||||||
defined('YII_DEBUG') or define('YII_DEBUG', true);
|
defined('YII_DEBUG') or define('YII_DEBUG', true);
|
||||||
|
|
||||||
require_once(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php');
|
require_once(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php');
|
||||||
require __DIR__ .'/../vendor/autoload.php';
|
require __DIR__ .'/../vendor/autoload.php';
|
||||||
|
|
||||||
\Codeception\Specify\Config::setDeepClone(false);
|
|
@ -9,6 +9,23 @@ class LoginFormCest
|
|||||||
public function openLoginPage(\FunctionalTester $I)
|
public function openLoginPage(\FunctionalTester $I)
|
||||||
{
|
{
|
||||||
$I->see('Login', 'h1');
|
$I->see('Login', 'h1');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// demonstrates `amLoggedAs` method
|
||||||
|
public function internalLoginById(\FunctionalTester $I)
|
||||||
|
{
|
||||||
|
$I->amLoggedAs(100);
|
||||||
|
$I->amOnPage('/');
|
||||||
|
$I->see('Logout (admin)');
|
||||||
|
}
|
||||||
|
|
||||||
|
// demonstrates `amLoggedAs` method
|
||||||
|
public function internalLoginBy(\FunctionalTester $I)
|
||||||
|
{
|
||||||
|
$I->amLoggedAs(\app\models\User::findByUsername('admin'));
|
||||||
|
$I->amOnPage('/');
|
||||||
|
$I->see('Logout (admin)');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function loginWithEmptyCredentials(\FunctionalTester $I)
|
public function loginWithEmptyCredentials(\FunctionalTester $I)
|
||||||
|
@ -36,8 +36,7 @@ class UserTest extends \Codeception\Test\Unit
|
|||||||
expect_not($user->validateAuthKey('test102key'));
|
expect_not($user->validateAuthKey('test102key'));
|
||||||
|
|
||||||
expect_that($user->validatePassword('admin'));
|
expect_that($user->validatePassword('admin'));
|
||||||
expect_not($user->validatePassword('123456'));
|
expect_not($user->validatePassword('123456'));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user