mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Обновлён Codeception до версии 2.1
This commit is contained in:
@ -63,9 +63,9 @@ docker-compose restart
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Прежде чем тестировать, необходимо накатить миграции
|
# Прежде чем тестировать, необходимо накатить миграции
|
||||||
docker exec -it db6366f120ee php tests/codeception/bin/yii migrate --interactive=0
|
docker exec -it app php tests/codeception/bin/yii migrate --interactive=0
|
||||||
# Собрать все тестовые окружения
|
# Собрать все тестовые окружения
|
||||||
docker exec -it db6366f120ee /bin/sh -c 'cd tests; ./../vendor/bin/codecept build'
|
docker exec -it app ./vendor/bin/codecept build -c tests
|
||||||
# И запустить собственно процесс тестирования
|
# И запустить собственно процесс тестирования
|
||||||
docker exec -it db6366f120ee /bin/sh -c 'cd tests; ./../vendor/bin/codecept run'
|
docker exec -it app ./vendor/bin/codecept run -c tests
|
||||||
```
|
```
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
"yiisoft/yii2-gii": "*",
|
"yiisoft/yii2-gii": "*",
|
||||||
"yiisoft/yii2-faker": "*",
|
"yiisoft/yii2-faker": "*",
|
||||||
"flow/jsonpath": "^0.3.1",
|
"flow/jsonpath": "^0.3.1",
|
||||||
"codeception/codeception": "2.0.*",
|
"codeception/codeception": "2.1.*",
|
||||||
"codeception/specify": "*",
|
"codeception/specify": "*",
|
||||||
"codeception/verify": "*"
|
"codeception/verify": "*"
|
||||||
},
|
},
|
||||||
|
3
tests/codeception/api/.gitignore
vendored
3
tests/codeception/api/.gitignore
vendored
@ -1,3 +1,2 @@
|
|||||||
# these files are auto generated by codeception build
|
# these files are auto generated by codeception build
|
||||||
/unit/UnitTester.php
|
_support/_generated
|
||||||
/functional/FunctionalTester.php
|
|
||||||
|
38
tests/codeception/api/_support/FunctionalTester.php
Normal file
38
tests/codeception/api/_support/FunctionalTester.php
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
namespace tests\codeception\api;
|
||||||
|
|
||||||
|
use tests\codeception\api\_pages\LoginRoute;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inherited Methods
|
||||||
|
* @method void wantToTest($text)
|
||||||
|
* @method void wantTo($text)
|
||||||
|
* @method void execute($callable)
|
||||||
|
* @method void expectTo($prediction)
|
||||||
|
* @method void expect($prediction)
|
||||||
|
* @method void amGoingTo($argumentation)
|
||||||
|
* @method void am($role)
|
||||||
|
* @method void lookForwardTo($achieveValue)
|
||||||
|
* @method void comment($description)
|
||||||
|
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
|
||||||
|
*
|
||||||
|
* @SuppressWarnings(PHPMD)
|
||||||
|
*/
|
||||||
|
class FunctionalTester extends \Codeception\Actor {
|
||||||
|
use _generated\FunctionalTesterActions;
|
||||||
|
|
||||||
|
public function loggedInAsActiveAccount() {
|
||||||
|
$I = $this;
|
||||||
|
$route = new LoginRoute($I);
|
||||||
|
$route->login('Admin', 'password_0');
|
||||||
|
$I->canSeeResponseIsJson();
|
||||||
|
$I->canSeeResponseJsonMatchesJsonPath('$.jwt');
|
||||||
|
$jwt = $I->grabDataFromResponseByJsonPath('$.jwt')[0];
|
||||||
|
$I->amBearerAuthenticated($jwt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function notLoggedIn() {
|
||||||
|
$this->haveHttpHeader('Authorization', null);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
26
tests/codeception/api/_support/UnitTester.php
Normal file
26
tests/codeception/api/_support/UnitTester.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
namespace tests\codeception\api;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inherited Methods
|
||||||
|
* @method void wantToTest($text)
|
||||||
|
* @method void wantTo($text)
|
||||||
|
* @method void execute($callable)
|
||||||
|
* @method void expectTo($prediction)
|
||||||
|
* @method void expect($prediction)
|
||||||
|
* @method void amGoingTo($argumentation)
|
||||||
|
* @method void am($role)
|
||||||
|
* @method void lookForwardTo($achieveValue)
|
||||||
|
* @method void comment($description)
|
||||||
|
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
|
||||||
|
*
|
||||||
|
* @SuppressWarnings(PHPMD)
|
||||||
|
*/
|
||||||
|
class UnitTester extends \Codeception\Actor
|
||||||
|
{
|
||||||
|
use _generated\UnitTesterActions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define custom actions here
|
||||||
|
*/
|
||||||
|
}
|
@ -1,12 +1,13 @@
|
|||||||
class_name: FunctionalTester
|
class_name: FunctionalTester
|
||||||
modules:
|
modules:
|
||||||
enabled:
|
enabled:
|
||||||
- Filesystem
|
- Filesystem
|
||||||
- Yii2
|
- Yii2
|
||||||
- tests\codeception\common\_support\FixtureHelper
|
- tests\codeception\common\_support\FixtureHelper
|
||||||
- REST
|
- REST:
|
||||||
- Redis
|
depends: Yii2
|
||||||
- AMQP
|
- Redis
|
||||||
|
- AMQP
|
||||||
config:
|
config:
|
||||||
Yii2:
|
Yii2:
|
||||||
configFile: '../config/api/functional.php'
|
configFile: '../config/api/functional.php'
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace tests\codeception\api\functional;
|
namespace tests\codeception\api\functional;
|
||||||
|
|
||||||
use Codeception\Scenario;
|
|
||||||
use Codeception\Specify;
|
use Codeception\Specify;
|
||||||
use common\models\Account;
|
use common\models\Account;
|
||||||
use tests\codeception\api\_pages\AccountsRoute;
|
use tests\codeception\api\_pages\AccountsRoute;
|
||||||
use tests\codeception\api\_pages\LoginRoute;
|
use tests\codeception\api\_pages\LoginRoute;
|
||||||
use tests\codeception\api\functional\_steps\AccountSteps;
|
|
||||||
use tests\codeception\api\FunctionalTester;
|
use tests\codeception\api\FunctionalTester;
|
||||||
|
|
||||||
class AccountsChangePasswordCest {
|
class AccountsChangePasswordCest {
|
||||||
@ -20,16 +18,15 @@ class AccountsChangePasswordCest {
|
|||||||
$this->route = new AccountsRoute($I);
|
$this->route = new AccountsRoute($I);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function _after(FunctionalTester $I) {
|
public function _after() {
|
||||||
/** @var Account $account */
|
/** @var Account $account */
|
||||||
$account = Account::findOne(1);
|
$account = Account::findOne(1);
|
||||||
$account->setPassword('password_0');
|
$account->setPassword('password_0');
|
||||||
$account->save();
|
$account->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testChangePassword(FunctionalTester $I, Scenario $scenario) {
|
public function testChangePassword(FunctionalTester $I) {
|
||||||
$I->wantTo('change my password');
|
$I->wantTo('change my password');
|
||||||
$I = new AccountSteps($scenario);
|
|
||||||
$I->loggedInAsActiveAccount();
|
$I->loggedInAsActiveAccount();
|
||||||
|
|
||||||
$this->route->changePassword('password_0', 'new-password', 'new-password');
|
$this->route->changePassword('password_0', 'new-password', 'new-password');
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace tests\codeception\api\functional;
|
namespace tests\codeception\api\functional;
|
||||||
|
|
||||||
use Codeception\Scenario;
|
|
||||||
use Codeception\Specify;
|
use Codeception\Specify;
|
||||||
use common\models\Account;
|
use common\models\Account;
|
||||||
use tests\codeception\api\_pages\AccountsRoute;
|
use tests\codeception\api\_pages\AccountsRoute;
|
||||||
use tests\codeception\api\functional\_steps\AccountSteps;
|
|
||||||
use tests\codeception\api\FunctionalTester;
|
use tests\codeception\api\FunctionalTester;
|
||||||
|
|
||||||
class AccountsChangeUsernameCest {
|
class AccountsChangeUsernameCest {
|
||||||
@ -19,16 +17,15 @@ class AccountsChangeUsernameCest {
|
|||||||
$this->route = new AccountsRoute($I);
|
$this->route = new AccountsRoute($I);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function _after(FunctionalTester $I) {
|
public function _after() {
|
||||||
/** @var Account $account */
|
/** @var Account $account */
|
||||||
$account = Account::findOne(1);
|
$account = Account::findOne(1);
|
||||||
$account->username = 'Admin';
|
$account->username = 'Admin';
|
||||||
$account->save();
|
$account->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testChangeUsername(FunctionalTester $I, Scenario $scenario) {
|
public function testChangeUsername(FunctionalTester $I) {
|
||||||
$I->wantTo('change my nickname');
|
$I->wantTo('change my nickname');
|
||||||
$I = new AccountSteps($scenario);
|
|
||||||
$I->loggedInAsActiveAccount();
|
$I->loggedInAsActiveAccount();
|
||||||
|
|
||||||
$this->route->changeUsername('password_0', 'bruce_wayne');
|
$this->route->changeUsername('password_0', 'bruce_wayne');
|
||||||
@ -39,9 +36,8 @@ class AccountsChangeUsernameCest {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testChangeUsernameNotAvailable(FunctionalTester $I, Scenario $scenario) {
|
public function testChangeUsernameNotAvailable(FunctionalTester $I) {
|
||||||
$I->wantTo('see, that nickname "in use" is not available');
|
$I->wantTo('see, that nickname "in use" is not available');
|
||||||
$I = new AccountSteps($scenario);
|
|
||||||
$I->loggedInAsActiveAccount();
|
$I->loggedInAsActiveAccount();
|
||||||
|
|
||||||
$this->route->changeUsername('password_0', 'Jon');
|
$this->route->changeUsername('password_0', 'Jon');
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace tests\codeception\api\functional;
|
namespace tests\codeception\api\functional;
|
||||||
|
|
||||||
use Codeception\Scenario;
|
|
||||||
use Codeception\Specify;
|
use Codeception\Specify;
|
||||||
use tests\codeception\api\_pages\AccountsRoute;
|
use tests\codeception\api\_pages\AccountsRoute;
|
||||||
use tests\codeception\api\functional\_steps\AccountSteps;
|
|
||||||
use tests\codeception\api\FunctionalTester;
|
use tests\codeception\api\FunctionalTester;
|
||||||
|
|
||||||
class AccountsCurrentCest {
|
class AccountsCurrentCest {
|
||||||
@ -18,8 +16,7 @@ class AccountsCurrentCest {
|
|||||||
$this->route = new AccountsRoute($I);
|
$this->route = new AccountsRoute($I);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCurrent(FunctionalTester $I, Scenario $scenario) {
|
public function testCurrent(FunctionalTester $I) {
|
||||||
$I = new AccountSteps($scenario);
|
|
||||||
$I->loggedInAsActiveAccount();
|
$I->loggedInAsActiveAccount();
|
||||||
|
|
||||||
$this->route->current();
|
$this->route->current();
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace tests\codeception\api;
|
namespace tests\codeception\api;
|
||||||
|
|
||||||
use Codeception\Scenario;
|
|
||||||
use tests\codeception\api\_pages\OauthRoute;
|
use tests\codeception\api\_pages\OauthRoute;
|
||||||
use tests\codeception\api\functional\_steps\OauthSteps;
|
use tests\codeception\api\functional\_steps\OauthSteps;
|
||||||
use Yii;
|
use Yii;
|
||||||
@ -38,8 +37,7 @@ class OauthAccessTokenCest {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIssueToken(FunctionalTester $I, Scenario $scenario) {
|
public function testIssueToken(OauthSteps $I) {
|
||||||
$I = new OauthSteps($scenario);
|
|
||||||
$authCode = $I->getAuthCode();
|
$authCode = $I->getAuthCode();
|
||||||
$this->route->issueToken($this->buildParams(
|
$this->route->issueToken($this->buildParams(
|
||||||
$authCode,
|
$authCode,
|
||||||
@ -56,8 +54,7 @@ class OauthAccessTokenCest {
|
|||||||
$I->canSeeResponseJsonMatchesJsonPath('$.expires_in');
|
$I->canSeeResponseJsonMatchesJsonPath('$.expires_in');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIssueTokenWithRefreshToken(FunctionalTester $I, Scenario $scenario) {
|
public function testIssueTokenWithRefreshToken(OauthSteps $I) {
|
||||||
$I = new OauthSteps($scenario);
|
|
||||||
$authCode = $I->getAuthCode(false);
|
$authCode = $I->getAuthCode(false);
|
||||||
$this->route->issueToken($this->buildParams(
|
$this->route->issueToken($this->buildParams(
|
||||||
$authCode,
|
$authCode,
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
namespace tests\codeception\api;
|
namespace tests\codeception\api;
|
||||||
|
|
||||||
use tests\codeception\api\_pages\OauthRoute;
|
use tests\codeception\api\_pages\OauthRoute;
|
||||||
use tests\codeception\api\functional\_steps\AccountSteps;
|
|
||||||
use Yii;
|
use Yii;
|
||||||
|
|
||||||
class OauthAuthCodeCest {
|
class OauthAuthCodeCest {
|
||||||
@ -54,6 +53,7 @@ class OauthAuthCodeCest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function testValidateWithDescriptionReplaceRequest(FunctionalTester $I) {
|
public function testValidateWithDescriptionReplaceRequest(FunctionalTester $I) {
|
||||||
|
$I->loggedInAsActiveAccount();
|
||||||
$I->wantTo('validate and get information with description replacement');
|
$I->wantTo('validate and get information with description replacement');
|
||||||
$this->route->validate($this->buildQueryParams(
|
$this->route->validate($this->buildQueryParams(
|
||||||
'ely',
|
'ely',
|
||||||
@ -74,15 +74,13 @@ class OauthAuthCodeCest {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCompleteValidationAction($I, $scenario) {
|
public function testCompleteValidationAction(FunctionalTester $I) {
|
||||||
$I = new AccountSteps($scenario);
|
|
||||||
$I->loggedInAsActiveAccount();
|
$I->loggedInAsActiveAccount();
|
||||||
$I->wantTo('validate all oAuth params on complete request');
|
$I->wantTo('validate all oAuth params on complete request');
|
||||||
$this->testOauthParamsValidation($I, 'complete');
|
$this->testOauthParamsValidation($I, 'complete');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCompleteActionOnWrongConditions($I, $scenario) {
|
public function testCompleteActionOnWrongConditions(FunctionalTester $I) {
|
||||||
$I = new AccountSteps($scenario);
|
|
||||||
$I->loggedInAsActiveAccount();
|
$I->loggedInAsActiveAccount();
|
||||||
|
|
||||||
$I->wantTo('get accept_required if I dom\'t require any scope, but this is first time request');
|
$I->wantTo('get accept_required if I dom\'t require any scope, but this is first time request');
|
||||||
@ -116,10 +114,8 @@ class OauthAuthCodeCest {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCompleteActionSuccess($I, $scenario) {
|
public function testCompleteActionSuccess(FunctionalTester $I) {
|
||||||
$I = new AccountSteps($scenario);
|
|
||||||
$I->loggedInAsActiveAccount();
|
$I->loggedInAsActiveAccount();
|
||||||
|
|
||||||
$I->wantTo('get auth code if I require some scope and pass accept field');
|
$I->wantTo('get auth code if I require some scope and pass accept field');
|
||||||
$this->route->complete($this->buildQueryParams(
|
$this->route->complete($this->buildQueryParams(
|
||||||
'ely',
|
'ely',
|
||||||
@ -161,8 +157,7 @@ class OauthAuthCodeCest {
|
|||||||
$I->canSeeResponseJsonMatchesJsonPath('$.redirectUri');
|
$I->canSeeResponseJsonMatchesJsonPath('$.redirectUri');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAcceptRequiredOnNewScope($I, $scenario) {
|
public function testAcceptRequiredOnNewScope(FunctionalTester $I) {
|
||||||
$I = new AccountSteps($scenario);
|
|
||||||
$I->loggedInAsActiveAccount();
|
$I->loggedInAsActiveAccount();
|
||||||
$I->wantTo('get accept_required if I have previous successful request, but now require some new scope');
|
$I->wantTo('get accept_required if I have previous successful request, but now require some new scope');
|
||||||
$this->route->complete($this->buildQueryParams(
|
$this->route->complete($this->buildQueryParams(
|
||||||
@ -186,8 +181,7 @@ class OauthAuthCodeCest {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCompleteActionWithDismissState($I, $scenario) {
|
public function testCompleteActionWithDismissState(FunctionalTester $I) {
|
||||||
$I = new AccountSteps($scenario);
|
|
||||||
$I->loggedInAsActiveAccount();
|
$I->loggedInAsActiveAccount();
|
||||||
$I->wantTo('get access_denied error if I pass accept in false state');
|
$I->wantTo('get access_denied error if I pass accept in false state');
|
||||||
$this->route->complete($this->buildQueryParams(
|
$this->route->complete($this->buildQueryParams(
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace tests\codeception\api;
|
namespace tests\codeception\api;
|
||||||
|
|
||||||
use Codeception\Scenario;
|
|
||||||
use common\models\OauthScope;
|
use common\models\OauthScope;
|
||||||
use tests\codeception\api\_pages\OauthRoute;
|
use tests\codeception\api\_pages\OauthRoute;
|
||||||
use tests\codeception\api\functional\_steps\OauthSteps;
|
use tests\codeception\api\functional\_steps\OauthSteps;
|
||||||
@ -18,8 +17,7 @@ class OauthRefreshTokenCest {
|
|||||||
$this->route = new OauthRoute($I);
|
$this->route = new OauthRoute($I);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRefreshToken(FunctionalTester $I, Scenario $scenario) {
|
public function testRefreshToken(OauthSteps $I) {
|
||||||
$I = new OauthSteps($scenario);
|
|
||||||
$refreshToken = $I->getRefreshToken();
|
$refreshToken = $I->getRefreshToken();
|
||||||
$this->route->issueToken($this->buildParams(
|
$this->route->issueToken($this->buildParams(
|
||||||
$refreshToken,
|
$refreshToken,
|
||||||
@ -36,8 +34,7 @@ class OauthRefreshTokenCest {
|
|||||||
$I->canSeeResponseJsonMatchesJsonPath('$.expires_in');
|
$I->canSeeResponseJsonMatchesJsonPath('$.expires_in');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRefreshTokenWithSameScopes(FunctionalTester $I, Scenario $scenario) {
|
public function testRefreshTokenWithSameScopes(OauthSteps $I) {
|
||||||
$I = new OauthSteps($scenario);
|
|
||||||
$refreshToken = $I->getRefreshToken();
|
$refreshToken = $I->getRefreshToken();
|
||||||
$this->route->issueToken($this->buildParams(
|
$this->route->issueToken($this->buildParams(
|
||||||
$refreshToken,
|
$refreshToken,
|
||||||
@ -55,8 +52,7 @@ class OauthRefreshTokenCest {
|
|||||||
$I->canSeeResponseJsonMatchesJsonPath('$.expires_in');
|
$I->canSeeResponseJsonMatchesJsonPath('$.expires_in');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRefreshTokenWithNewScopes(FunctionalTester $I, Scenario $scenario) {
|
public function testRefreshTokenWithNewScopes(OauthSteps $I) {
|
||||||
$I = new OauthSteps($scenario);
|
|
||||||
$refreshToken = $I->getRefreshToken();
|
$refreshToken = $I->getRefreshToken();
|
||||||
$this->route->issueToken($this->buildParams(
|
$this->route->issueToken($this->buildParams(
|
||||||
$refreshToken,
|
$refreshToken,
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace tests\codeception\api\functional\_steps;
|
|
||||||
|
|
||||||
use tests\codeception\api\_pages\LoginRoute;
|
|
||||||
use tests\codeception\api\FunctionalTester;
|
|
||||||
|
|
||||||
class AccountSteps extends FunctionalTester {
|
|
||||||
|
|
||||||
public function loggedInAsActiveAccount() {
|
|
||||||
$I = $this;
|
|
||||||
$route = new LoginRoute($I);
|
|
||||||
$route->login('Admin', 'password_0');
|
|
||||||
$I->canSeeResponseIsJson();
|
|
||||||
$I->canSeeResponseJsonMatchesJsonPath('$.jwt');
|
|
||||||
$jwt = $I->grabDataFromResponseByJsonPath('$.jwt')[0];
|
|
||||||
$I->amBearerAuthenticated($jwt);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function notLoggedIn() {
|
|
||||||
$this->haveHttpHeader('Authorization', null);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -3,7 +3,7 @@ namespace tests\codeception\api\functional\_steps;
|
|||||||
|
|
||||||
use tests\codeception\api\_pages\OauthRoute;
|
use tests\codeception\api\_pages\OauthRoute;
|
||||||
|
|
||||||
class OauthSteps extends AccountSteps {
|
class OauthSteps extends \tests\codeception\api\FunctionalTester {
|
||||||
|
|
||||||
public function getAuthCode($online = true) {
|
public function getAuthCode($online = true) {
|
||||||
// TODO: по идее можно напрямую сделать зпись в базу, что ускорит процесс тестирования
|
// TODO: по идее можно напрямую сделать зпись в базу, что ускорит процесс тестирования
|
||||||
|
@ -71,9 +71,10 @@ class ChangePasswordFormTest extends DbTestCase {
|
|||||||
'newRePassword' => 'my-new-password',
|
'newRePassword' => 'my-new-password',
|
||||||
]);
|
]);
|
||||||
$this->specify('successfully change password with modern hash strategy', function() use ($model, $account) {
|
$this->specify('successfully change password with modern hash strategy', function() use ($model, $account) {
|
||||||
|
$callTime = time();
|
||||||
expect('form should return true', $model->changePassword())->true();
|
expect('form should return true', $model->changePassword())->true();
|
||||||
expect('new password should be successfully stored into account', $account->validatePassword('my-new-password'))->true();
|
expect('new password should be successfully stored into account', $account->validatePassword('my-new-password'))->true();
|
||||||
expect('password change time updated', $account->password_changed_at)->greaterOrEquals(time() - 2);
|
expect('password change time updated', $account->password_changed_at)->greaterOrEquals($callTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
/** @var Account $account */
|
/** @var Account $account */
|
||||||
|
3
tests/codeception/common/.gitignore
vendored
3
tests/codeception/common/.gitignore
vendored
@ -1,3 +1,2 @@
|
|||||||
# these files are auto generated by codeception build
|
# these files are auto generated by codeception build
|
||||||
/unit/UnitTester.php
|
_support/_generated
|
||||||
/functional/FunctionalTester.php
|
|
||||||
|
25
tests/codeception/common/_support/UnitTester.php
Normal file
25
tests/codeception/common/_support/UnitTester.php
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
namespace tests\codeception\common;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inherited Methods
|
||||||
|
* @method void wantToTest($text)
|
||||||
|
* @method void wantTo($text)
|
||||||
|
* @method void execute($callable)
|
||||||
|
* @method void expectTo($prediction)
|
||||||
|
* @method void expect($prediction)
|
||||||
|
* @method void amGoingTo($argumentation)
|
||||||
|
* @method void am($role)
|
||||||
|
* @method void lookForwardTo($achieveValue)
|
||||||
|
* @method void comment($description)
|
||||||
|
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
|
||||||
|
*
|
||||||
|
* @SuppressWarnings(PHPMD)
|
||||||
|
*/
|
||||||
|
class UnitTester extends \Codeception\Actor {
|
||||||
|
use _generated\UnitTesterActions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define custom actions here
|
||||||
|
*/
|
||||||
|
}
|
2
tests/codeception/console/.gitignore
vendored
2
tests/codeception/console/.gitignore
vendored
@ -1,2 +1,2 @@
|
|||||||
# these files are auto generated by codeception build
|
# these files are auto generated by codeception build
|
||||||
/unit/UnitTester.php
|
_support/_generated
|
||||||
|
26
tests/codeception/console/_support/UnitTester.php
Normal file
26
tests/codeception/console/_support/UnitTester.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
namespace tests\codeception\console;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inherited Methods
|
||||||
|
* @method void wantToTest($text)
|
||||||
|
* @method void wantTo($text)
|
||||||
|
* @method void execute($callable)
|
||||||
|
* @method void expectTo($prediction)
|
||||||
|
* @method void expect($prediction)
|
||||||
|
* @method void amGoingTo($argumentation)
|
||||||
|
* @method void am($role)
|
||||||
|
* @method void lookForwardTo($achieveValue)
|
||||||
|
* @method void comment($description)
|
||||||
|
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
|
||||||
|
*
|
||||||
|
* @SuppressWarnings(PHPMD)
|
||||||
|
*/
|
||||||
|
class UnitTester extends \Codeception\Actor
|
||||||
|
{
|
||||||
|
use _generated\UnitTesterActions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define custom actions here
|
||||||
|
*/
|
||||||
|
}
|
Reference in New Issue
Block a user