2016-02-24 04:04:01 +05:30
|
|
|
<?php
|
|
|
|
namespace tests\codeception\api\_pages;
|
|
|
|
|
|
|
|
use yii\codeception\BasePage;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @property \tests\codeception\api\FunctionalTester $actor
|
|
|
|
*/
|
2016-02-26 04:15:21 +05:30
|
|
|
class AccountsRoute extends BasePage {
|
2016-02-24 04:04:01 +05:30
|
|
|
|
2017-09-19 22:36:16 +05:30
|
|
|
public function get(int $accountId) {
|
|
|
|
$this->route = "/v1/accounts/{$accountId}";
|
2016-02-24 04:04:01 +05:30
|
|
|
$this->actor->sendGET($this->getUrl());
|
|
|
|
}
|
|
|
|
|
2017-09-19 22:36:16 +05:30
|
|
|
public function changePassword(int $accountId, $currentPassword = null, $newPassword = null, $newRePassword = null) {
|
|
|
|
$this->route = "/v1/accounts/{$accountId}/password";
|
2016-02-27 03:52:09 +05:30
|
|
|
$this->actor->sendPOST($this->getUrl(), [
|
|
|
|
'password' => $currentPassword,
|
|
|
|
'newPassword' => $newPassword,
|
|
|
|
'newRePassword' => $newRePassword,
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2017-09-19 22:36:16 +05:30
|
|
|
public function changeUsername(int $accountId, $currentPassword = null, $newUsername = null) {
|
|
|
|
$this->route = "/v1/accounts/{$accountId}/username";
|
2016-03-20 04:55:26 +05:30
|
|
|
$this->actor->sendPOST($this->getUrl(), [
|
|
|
|
'password' => $currentPassword,
|
|
|
|
'username' => $newUsername,
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2017-09-19 22:36:16 +05:30
|
|
|
public function changeEmailInitialize(int $accountId, $password = '') {
|
|
|
|
$this->route = "/v1/accounts/{$accountId}/email-verification";
|
2016-05-23 23:57:09 +05:30
|
|
|
$this->actor->sendPOST($this->getUrl(), [
|
|
|
|
'password' => $password,
|
|
|
|
]);
|
2016-05-16 13:51:12 +05:30
|
|
|
}
|
|
|
|
|
2017-09-19 22:36:16 +05:30
|
|
|
public function changeEmailSubmitNewEmail(int $accountId, $key = null, $email = null) {
|
|
|
|
$this->route = "/v1/accounts/{$accountId}/new-email-verification";
|
2016-05-17 01:39:44 +05:30
|
|
|
$this->actor->sendPOST($this->getUrl(), [
|
|
|
|
'key' => $key,
|
|
|
|
'email' => $email,
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2017-09-19 22:36:16 +05:30
|
|
|
public function changeEmail(int $accountId, $key = null) {
|
|
|
|
$this->route = "/v1/accounts/{$accountId}/email";
|
2016-05-17 01:39:44 +05:30
|
|
|
$this->actor->sendPOST($this->getUrl(), [
|
|
|
|
'key' => $key,
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2017-09-19 22:36:16 +05:30
|
|
|
public function changeLanguage(int $accountId, $lang = null) {
|
|
|
|
$this->route = "/v1/accounts/{$accountId}/language";
|
2016-05-19 03:40:05 +05:30
|
|
|
$this->actor->sendPOST($this->getUrl(), [
|
|
|
|
'lang' => $lang,
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2017-09-19 22:36:16 +05:30
|
|
|
public function acceptRules(int $accountId) {
|
|
|
|
$this->route = "/v1/accounts/{$accountId}/rules";
|
2016-08-06 21:52:09 +05:30
|
|
|
$this->actor->sendPOST($this->getUrl());
|
|
|
|
}
|
|
|
|
|
2017-09-19 22:36:16 +05:30
|
|
|
public function ban(int $accountId) {
|
|
|
|
$this->route = "/v1/accounts/{$accountId}/ban";
|
|
|
|
$this->actor->sendPOST($this->getUrl());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function pardon($accountId) {
|
|
|
|
$this->route = "/v1/accounts/{$accountId}/ban";
|
|
|
|
$this->actor->sendDELETE($this->getUrl());
|
|
|
|
}
|
|
|
|
|
2016-02-24 04:04:01 +05:30
|
|
|
}
|