2016-05-10 23:25:04 +03:00
|
|
|
<?php
|
|
|
|
namespace tests\codeception\api\_pages;
|
|
|
|
|
|
|
|
use yii\codeception\BasePage;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @property \tests\codeception\api\FunctionalTester $actor
|
|
|
|
*/
|
|
|
|
class AuthenticationRoute extends BasePage {
|
|
|
|
|
2016-05-30 02:44:17 +03:00
|
|
|
public function login($login = '', $password = '', $rememberMe = false) {
|
2016-05-10 23:25:04 +03:00
|
|
|
$this->route = ['authentication/login'];
|
2016-05-30 02:44:17 +03:00
|
|
|
$params = [
|
2016-05-10 23:25:04 +03:00
|
|
|
'login' => $login,
|
|
|
|
'password' => $password,
|
2016-05-30 02:44:17 +03:00
|
|
|
];
|
|
|
|
|
|
|
|
if ($rememberMe) {
|
|
|
|
$params['rememberMe'] = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->actor->sendPOST($this->getUrl(), $params);
|
2016-05-10 23:25:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public function forgotPassword($login = '') {
|
|
|
|
$this->route = ['authentication/forgot-password'];
|
|
|
|
$this->actor->sendPOST($this->getUrl(), [
|
|
|
|
'login' => $login,
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2016-05-12 01:13:19 +03:00
|
|
|
public function recoverPassword($key = null, $newPassword = null, $newRePassword = null) {
|
|
|
|
$this->route = ['authentication/recover-password'];
|
|
|
|
$this->actor->sendPOST($this->getUrl(), [
|
|
|
|
'key' => $key,
|
|
|
|
'newPassword' => $newPassword,
|
|
|
|
'newRePassword' => $newRePassword,
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2016-05-31 01:03:30 +03:00
|
|
|
public function refreshToken($refreshToken = null) {
|
|
|
|
$this->route = ['authentication/refresh-token'];
|
|
|
|
$this->actor->sendPOST($this->getUrl(), [
|
|
|
|
'refresh_token' => $refreshToken,
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2016-05-10 23:25:04 +03:00
|
|
|
}
|