Rework tests structure. Upgrade codeception to 2.5.3. Merge params configuration into app configuration.

This commit is contained in:
ErickSkrauch 2019-02-20 22:58:52 +03:00
parent 2eacc581be
commit b05dc6816e
248 changed files with 1503 additions and 1339 deletions

4
.gitignore vendored
View File

@ -23,3 +23,7 @@ npm-debug*
# PHP-CS-Fixer
.php_cs
.php_cs.cache
# Codeception
codeception.yml
*/codeception.yml

26
api/codeception.dist.yml Normal file
View File

@ -0,0 +1,26 @@
namespace: api\tests
actor_suffix: Tester
paths:
tests: tests
log: tests/_output
data: tests/_data
helpers: tests/_support
settings:
bootstrap: _bootstrap.php
colors: true
memory_limit: 1024M
coverage:
enabled: true
remote: true
whitelist:
include:
- ./*
exclude:
- aop/*
- config/*
- runtime/*
- tests/*
- web/*
- codeception.dist.yml
- codeception.yml
c3url: 'http://localhost/api/web/index.php'

View File

@ -1,7 +1,4 @@
<?php
use api\components\ReCaptcha\Validator;
use GuzzleHttp\Client;
return [
'components' => [
'user' => [
@ -12,18 +9,13 @@ return [
'secret' => 'private-key',
],
],
'modules' => [
'authserver' => [
'host' => 'localhost',
],
],
'params' => [
'authserverHost' => 'authserver.ely.by',
'authserverHost' => 'localhost',
],
'container' => [
'definitions' => [
Validator::class => function() {
return new class(new Client()) extends Validator {
api\components\ReCaptcha\Validator::class => function() {
return new class(new GuzzleHttp\Client()) extends api\components\ReCaptcha\Validator {
protected function validateValue($value) {
return null;
}

View File

@ -1,15 +1,12 @@
<?php
$params = array_merge(
require __DIR__ . '/../../common/config/params.php',
require __DIR__ . '/params.php'
);
return [
'id' => 'accounts-site-api',
'basePath' => dirname(__DIR__),
'bootstrap' => ['log', 'authserver', 'internal'],
'bootstrap' => ['log', 'authserver', 'internal', 'mojang'],
'controllerNamespace' => 'api\controllers',
'params' => $params,
'params' => [
'authserverHost' => getenv('AUTHSERVER_HOST'),
],
'components' => [
'user' => [
'class' => api\components\User\Component::class,
@ -79,10 +76,7 @@ return [
],
],
'modules' => [
'authserver' => [
'class' => api\modules\authserver\Module::class,
'host' => $params['authserverHost'],
],
'authserver' => api\modules\authserver\Module::class,
'session' => api\modules\session\Module::class,
'mojang' => api\modules\mojang\Module::class,
'internal' => api\modules\internal\Module::class,

View File

@ -1,4 +0,0 @@
<?php
return [
'authserverHost' => getenv('AUTHSERVER_HOST'),
];

View File

@ -1,7 +1,4 @@
<?php
/**
* @var array $params
*/
return [
// Oauth module routes
'/oauth2/v1/<action>' => 'oauth/authorization/<action>',
@ -46,8 +43,4 @@ return [
'/mojang/profiles/<username>' => 'mojang/api/uuid-by-username',
'/mojang/profiles/<uuid>/names' => 'mojang/api/usernames-by-uuid',
'POST /mojang/profiles' => 'mojang/api/uuids-by-usernames',
"//{$params['authserverHost']}/mojang/api/users/profiles/minecraft/<username>" => 'mojang/api/uuid-by-username',
"//{$params['authserverHost']}/mojang/api/user/profiles/<uuid>/names" => 'mojang/api/usernames-by-uuid',
"POST //{$params['authserverHost']}/mojang/api/profiles/minecraft" => 'mojang/api/uuids-by-usernames',
];

View File

@ -1,9 +1,10 @@
<?php
declare(strict_types=1);
namespace api\modules\authserver;
use Yii;
use yii\base\BootstrapInterface;
use yii\base\InvalidConfigException;
use yii\web\NotFoundHttpException;
class Module extends \yii\base\Module implements BootstrapInterface {
@ -12,18 +13,6 @@ class Module extends \yii\base\Module implements BootstrapInterface {
public $defaultRoute = 'index';
/**
* @var string базовый домен, запросы на который этот модуль должен обрабатывать
*/
public $host = 'authserver.ely.by';
public function init() {
parent::init();
if ($this->host === null) {
throw new InvalidConfigException('base domain must be specified');
}
}
public function beforeAction($action) {
if (!parent::beforeAction($action)) {
return false;
@ -35,11 +24,12 @@ class Module extends \yii\base\Module implements BootstrapInterface {
}
/**
* @param \yii\base\Application $app the application currently running
* @param \yii\base\Application $app
*/
public function bootstrap($app) {
$legacyHost = $app->params['authserverHost'];
$app->getUrlManager()->addRules([
"//$this->host/$this->id/auth/<action>" => "$this->id/authentication/<action>",
"//{$legacyHost}/authserver/auth/<action>" => "{$this->id}/authentication/<action>",
], false);
}
@ -59,7 +49,7 @@ class Module extends \yii\base\Module implements BootstrapInterface {
* @throws NotFoundHttpException
*/
protected function checkHost() {
if (parse_url(Yii::$app->request->getHostInfo(), PHP_URL_HOST) !== $this->host) {
if (parse_url(Yii::$app->request->getHostInfo(), PHP_URL_HOST) !== Yii::$app->params['authserverHost']) {
throw new NotFoundHttpException();
}
}

View File

@ -1,10 +1,26 @@
<?php
declare(strict_types=1);
namespace api\modules\mojang;
class Module extends \yii\base\Module {
use yii\base\BootstrapInterface;
class Module extends \yii\base\Module implements BootstrapInterface {
public $id = 'mojang';
public $defaultRoute = 'api';
/**
* @param \yii\base\Application $app
*/
public function bootstrap($app): void {
$legacyHost = $app->params['authserverHost'];
$app->getUrlManager()->addRules([
"//{$legacyHost}/mojang/api/users/profiles/minecraft/<username>" => "{$this->id}/api/uuid-by-username",
"//{$legacyHost}/mojang/api/user/profiles/<uuid>/names" => "{$this->id}/api/usernames-by-uuid",
"POST //{$legacyHost}/mojang/api/profiles/minecraft" => "{$this->id}/api/uuids-by-usernames",
]);
}
}

View File

@ -55,7 +55,10 @@ class AuthorizationController extends Controller {
}
private function createOauthProcess(): OauthProcess {
return new OauthProcess(Yii::$app->oauth->authServer);
$server = Yii::$app->oauth->authServer;
$server->setRequest(null); // Enforce request recreation (test environment bug)
return new OauthProcess($server);
}
}

3
api/tests/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
functional.suite.yml
unit.suite.yml
_support/_generated

10
api/tests/_bootstrap.php Normal file
View File

@ -0,0 +1,10 @@
<?php
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'test');
defined('YII_APP_BASE_PATH') or define('YII_APP_BASE_PATH', __DIR__ . '/../../');
require_once YII_APP_BASE_PATH . '/vendor/autoload.php';
require_once YII_APP_BASE_PATH . '/vendor/yiisoft/yii2/Yii.php';
require_once YII_APP_BASE_PATH . '/common/config/bootstrap.php';
require_once __DIR__ . '/../config/bootstrap.php';

View File

@ -1,14 +1,14 @@
<?php
namespace tests\codeception\api\_pages;
namespace api\tests\_pages;
class AccountsRoute extends BasePage {
public function get(int $accountId) {
$this->getActor()->sendGET("/v1/accounts/{$accountId}");
$this->getActor()->sendGET("/api/v1/accounts/{$accountId}");
}
public function changePassword(int $accountId, $currentPassword = null, $newPassword = null, $newRePassword = null) {
$this->getActor()->sendPOST("/v1/accounts/{$accountId}/password", [
$this->getActor()->sendPOST("/api/v1/accounts/{$accountId}/password", [
'password' => $currentPassword,
'newPassword' => $newPassword,
'newRePassword' => $newRePassword,
@ -16,65 +16,65 @@ class AccountsRoute extends BasePage {
}
public function changeUsername(int $accountId, $currentPassword = null, $newUsername = null) {
$this->getActor()->sendPOST("/v1/accounts/{$accountId}/username", [
$this->getActor()->sendPOST("/api/v1/accounts/{$accountId}/username", [
'password' => $currentPassword,
'username' => $newUsername,
]);
}
public function changeEmailInitialize(int $accountId, $password = '') {
$this->getActor()->sendPOST("/v1/accounts/{$accountId}/email-verification", [
$this->getActor()->sendPOST("/api/v1/accounts/{$accountId}/email-verification", [
'password' => $password,
]);
}
public function changeEmailSubmitNewEmail(int $accountId, $key = null, $email = null) {
$this->getActor()->sendPOST("/v1/accounts/{$accountId}/new-email-verification", [
$this->getActor()->sendPOST("/api/v1/accounts/{$accountId}/new-email-verification", [
'key' => $key,
'email' => $email,
]);
}
public function changeEmail(int $accountId, $key = null) {
$this->getActor()->sendPOST("/v1/accounts/{$accountId}/email", [
$this->getActor()->sendPOST("/api/v1/accounts/{$accountId}/email", [
'key' => $key,
]);
}
public function changeLanguage(int $accountId, $lang = null) {
$this->getActor()->sendPOST("/v1/accounts/{$accountId}/language", [
$this->getActor()->sendPOST("/api/v1/accounts/{$accountId}/language", [
'lang' => $lang,
]);
}
public function acceptRules(int $accountId) {
$this->getActor()->sendPOST("/v1/accounts/{$accountId}/rules");
$this->getActor()->sendPOST("/api/v1/accounts/{$accountId}/rules");
}
public function getTwoFactorAuthCredentials(int $accountId) {
$this->getActor()->sendGET("/v1/accounts/{$accountId}/two-factor-auth");
$this->getActor()->sendGET("/api/v1/accounts/{$accountId}/two-factor-auth");
}
public function enableTwoFactorAuth(int $accountId, $totp = null, $password = null) {
$this->getActor()->sendPOST("/v1/accounts/{$accountId}/two-factor-auth", [
$this->getActor()->sendPOST("/api/v1/accounts/{$accountId}/two-factor-auth", [
'totp' => $totp,
'password' => $password,
]);
}
public function disableTwoFactorAuth(int $accountId, $totp = null, $password = null) {
$this->getActor()->sendDELETE("/v1/accounts/{$accountId}/two-factor-auth", [
$this->getActor()->sendDELETE("/api/v1/accounts/{$accountId}/two-factor-auth", [
'totp' => $totp,
'password' => $password,
]);
}
public function ban(int $accountId) {
$this->getActor()->sendPOST("/v1/accounts/{$accountId}/ban");
$this->getActor()->sendPOST("/api/v1/accounts/{$accountId}/ban");
}
public function pardon(int $accountId) {
$this->getActor()->sendDELETE("/v1/accounts/{$accountId}/ban");
$this->getActor()->sendDELETE("/api/v1/accounts/{$accountId}/ban");
}
}

View File

@ -1,5 +1,5 @@
<?php
namespace tests\codeception\api\_pages;
namespace api\tests\_pages;
class AuthenticationRoute extends BasePage {
@ -21,22 +21,22 @@ class AuthenticationRoute extends BasePage {
$params['totp'] = $rememberMeOrToken;
}
$this->getActor()->sendPOST('/authentication/login', $params);
$this->getActor()->sendPOST('/api/authentication/login', $params);
}
public function logout() {
$this->getActor()->sendPOST('/authentication/logout');
$this->getActor()->sendPOST('/api/authentication/logout');
}
public function forgotPassword($login = null, $token = null) {
$this->getActor()->sendPOST('/authentication/forgot-password', [
$this->getActor()->sendPOST('/api/authentication/forgot-password', [
'login' => $login,
'totp' => $token,
]);
}
public function recoverPassword($key = null, $newPassword = null, $newRePassword = null) {
$this->getActor()->sendPOST('/authentication/recover-password', [
$this->getActor()->sendPOST('/api/authentication/recover-password', [
'key' => $key,
'newPassword' => $newPassword,
'newRePassword' => $newRePassword,
@ -44,7 +44,7 @@ class AuthenticationRoute extends BasePage {
}
public function refreshToken($refreshToken = null) {
$this->getActor()->sendPOST('/authentication/refresh-token', [
$this->getActor()->sendPOST('/api/authentication/refresh-token', [
'refresh_token' => $refreshToken,
]);
}

View File

@ -0,0 +1,26 @@
<?php
namespace api\tests\_pages;
class AuthserverRoute extends BasePage {
public function authenticate($params) {
$this->getActor()->sendPOST('/api/authserver/authentication/authenticate', $params);
}
public function refresh($params) {
$this->getActor()->sendPOST('/api/authserver/authentication/refresh', $params);
}
public function validate($params) {
$this->getActor()->sendPOST('/api/authserver/authentication/validate', $params);
}
public function invalidate($params) {
$this->getActor()->sendPOST('/api/authserver/authentication/invalidate', $params);
}
public function signout($params) {
$this->getActor()->sendPOST('/api/authserver/authentication/signout', $params);
}
}

View File

@ -1,7 +1,7 @@
<?php
namespace tests\codeception\api\_pages;
namespace api\tests\_pages;
use tests\codeception\api\FunctionalTester;
use api\tests\FunctionalTester;
class BasePage {

View File

@ -0,0 +1,10 @@
<?php
namespace api\tests\_pages;
class IdentityInfoRoute extends BasePage {
public function info() {
$this->getActor()->sendGET('/api/account/v1/info');
}
}

View File

@ -0,0 +1,10 @@
<?php
namespace api\tests\_pages;
class InternalRoute extends BasePage {
public function info(string $param, string $value) {
$this->getActor()->sendGET('/api/internal/accounts/info', [$param => $value]);
}
}

View File

@ -1,19 +1,19 @@
<?php
namespace tests\codeception\api\_pages;
namespace api\tests\_pages;
class MojangApiRoute extends BasePage {
public function usernameToUuid($username, $at = null) {
$params = $at === null ? [] : ['at' => $at];
$this->getActor()->sendGET("/mojang/profiles/{$username}", $params);
$this->getActor()->sendGET("/api/mojang/profiles/{$username}", $params);
}
public function usernamesByUuid($uuid) {
$this->getActor()->sendGET("/mojang/profiles/{$uuid}/names");
$this->getActor()->sendGET("/api/mojang/profiles/{$uuid}/names");
}
public function uuidsByUsernames($uuids) {
$this->getActor()->sendPOST('/mojang/profiles', $uuids);
$this->getActor()->sendPOST('/api/mojang/profiles', $uuids);
}
}

View File

@ -0,0 +1,42 @@
<?php
namespace api\tests\_pages;
class OauthRoute extends BasePage {
public function validate(array $queryParams): void {
$this->getActor()->sendGET('/api/oauth2/v1/validate', $queryParams);
}
public function complete(array $queryParams = [], array $postParams = []): void {
$this->getActor()->sendPOST('/api/oauth2/v1/complete?' . http_build_query($queryParams), $postParams);
}
public function issueToken(array $postParams = []): void {
$this->getActor()->sendPOST('/api/oauth2/v1/token', $postParams);
}
public function createClient(string $type, array $postParams): void {
$this->getActor()->sendPOST('/api/v1/oauth2/' . $type, $postParams);
}
public function updateClient(string $clientId, array $params): void {
$this->getActor()->sendPUT('/api/v1/oauth2/' . $clientId, $params);
}
public function deleteClient(string $clientId): void {
$this->getActor()->sendDELETE('/api/v1/oauth2/' . $clientId);
}
public function resetClient(string $clientId, bool $regenerateSecret = false): void {
$this->getActor()->sendPOST("/api/v1/oauth2/$clientId/reset" . ($regenerateSecret ? '?regenerateSecret' : ''));
}
public function getClient(string $clientId): void {
$this->getActor()->sendGET("/api/v1/oauth2/$clientId");
}
public function getPerAccount(int $accountId): void {
$this->getActor()->sendGET("/api/v1/accounts/$accountId/oauth2/clients");
}
}

View File

@ -0,0 +1,10 @@
<?php
namespace api\tests\_pages;
class OptionsRoute extends BasePage {
public function get() {
$this->getActor()->sendGET('/api/options');
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace api\tests\_pages;
class SessionServerRoute extends BasePage {
public function join($params) {
$this->getActor()->sendPOST('/api/minecraft/session/join', $params);
}
public function joinLegacy(array $params) {
$this->getActor()->sendGET('/api/minecraft/session/legacy/join', $params);
}
public function hasJoined(array $params) {
$this->getActor()->sendGET('/api/minecraft/session/hasJoined', $params);
}
public function hasJoinedLegacy(array $params) {
$this->getActor()->sendGET('/api/minecraft/session/legacy/hasJoined', $params);
}
public function profile($profileUuid) {
$this->getActor()->sendGET("/api/minecraft/session/profile/{$profileUuid}");
}
}

View File

@ -1,18 +1,18 @@
<?php
namespace tests\codeception\api\_pages;
namespace api\tests\_pages;
class SignupRoute extends BasePage {
public function register(array $registrationData) {
$this->getActor()->sendPOST('/signup', $registrationData);
$this->getActor()->sendPOST('/api/signup', $registrationData);
}
public function sendRepeatMessage($email = '') {
$this->getActor()->sendPOST('/signup/repeat-message', ['email' => $email]);
$this->getActor()->sendPOST('/api/signup/repeat-message', ['email' => $email]);
}
public function confirm($key = '') {
$this->getActor()->sendPOST('/signup/confirm', [
$this->getActor()->sendPOST('/api/signup/confirm', [
'key' => $key,
]);
}

View File

@ -1,28 +1,16 @@
<?php
namespace tests\codeception\api;
declare(strict_types=1);
namespace api\tests;
use api\tests\_generated\FunctionalTesterActions;
use Codeception\Actor;
use common\models\Account;
use InvalidArgumentException;
use Yii;
/**
* 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 Actor {
use _generated\FunctionalTesterActions;
use FunctionalTesterActions;
public function amAuthenticated(string $asUsername = 'admin') {
/** @var Account $account */
@ -37,11 +25,12 @@ class FunctionalTester extends Actor {
return $account->id;
}
public function notLoggedIn() {
public function notLoggedIn(): void {
$this->haveHttpHeader('Authorization', null);
Yii::$app->user->logout();
}
public function canSeeAuthCredentials($expectRefresh = false) {
public function canSeeAuthCredentials($expectRefresh = false): void {
$this->canSeeResponseJsonMatchesJsonPath('$.access_token');
$this->canSeeResponseJsonMatchesJsonPath('$.expires_in');
if ($expectRefresh) {

View File

@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace api\tests;
use api\tests\_generated\UnitTesterActions;
use Codeception\Actor;
class UnitTester extends Actor {
use UnitTesterActions;
}

View File

@ -0,0 +1,8 @@
<?php
use common\config\ConfigLoader;
use yii\helpers\ArrayHelper;
return ArrayHelper::merge(ConfigLoader::load('api'), [
]);

View File

@ -0,0 +1,8 @@
<?php
use common\config\ConfigLoader;
use yii\helpers\ArrayHelper;
return ArrayHelper::merge(ConfigLoader::load('api'), [
]);

View File

@ -0,0 +1,20 @@
suite_namespace: api\tests\functional
actor: FunctionalTester
modules:
enabled:
- Asserts
- Filesystem
- Yii2:
configFile: tests/config/functional.php
entryScript: /api/web/index.php
recreateApplication: true
transaction: false
- common\tests\_support\FixtureHelper
- common\tests\_support\Mockery
- REST:
depends: Yii2
- Redis:
host: redis
port: 6379
database: 0
cleanupBefore: 'test'

View File

@ -1,7 +1,8 @@
<?php
namespace tests\codeception\api;
namespace api\tests\functional;
use tests\codeception\api\_pages\SignupRoute;
use api\tests\_pages\SignupRoute;
use api\tests\FunctionalTester;
class EmailConfirmationCest {

View File

@ -1,12 +1,12 @@
<?php
namespace tests\codeception\api\functional;
namespace api\tests\functional;
use tests\codeception\api\FunctionalTester;
use api\tests\FunctionalTester;
class FeedbackCest {
public function testFeedbackWithoutAuth(FunctionalTester $I) {
$I->sendPOST('/feedback', [
$I->sendPOST('/api/feedback', [
'subject' => 'Test',
'email' => 'email@ely.by',
'type' => 0,
@ -21,7 +21,7 @@ class FeedbackCest {
public function testFeedbackWithAuth(FunctionalTester $I) {
$I->amAuthenticated();
$I->sendPOST('/feedback', [
$I->sendPOST('/api/feedback', [
'subject' => 'Test',
'email' => 'email@ely.by',
'type' => 0,

View File

@ -1,8 +1,8 @@
<?php
namespace codeception\api\functional;
namespace api\tests\functional;
use tests\codeception\api\_pages\AuthenticationRoute;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\AuthenticationRoute;
use api\tests\FunctionalTester;
class ForgotPasswordCest {

View File

@ -1,8 +1,9 @@
<?php
namespace tests\codeception\api;
namespace api\tests\functional;
use api\tests\FunctionalTester;
use OTPHP\TOTP;
use tests\codeception\api\_pages\AuthenticationRoute;
use api\tests\_pages\AuthenticationRoute;
class LoginCest {

View File

@ -1,7 +1,8 @@
<?php
namespace tests\codeception\api;
namespace api\tests\functional;
use tests\codeception\api\_pages\AuthenticationRoute;
use api\tests\_pages\AuthenticationRoute;
use api\tests\FunctionalTester;
class LogoutCest {

View File

@ -1,8 +1,8 @@
<?php
namespace codeception\api\functional;
namespace api\tests\functional;
use tests\codeception\api\_pages\OptionsRoute;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\OptionsRoute;
use api\tests\FunctionalTester;
class OptionsCest {

View File

@ -1,9 +1,9 @@
<?php
namespace codeception\api\functional;
namespace api\tests\functional;
use tests\codeception\api\_pages\AccountsRoute;
use tests\codeception\api\_pages\AuthenticationRoute;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\AccountsRoute;
use api\tests\_pages\AuthenticationRoute;
use api\tests\FunctionalTester;
class RecoverPasswordCest {

View File

@ -1,8 +1,8 @@
<?php
namespace codeception\api\functional;
namespace api\tests\functional;
use tests\codeception\api\_pages\AuthenticationRoute;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\AuthenticationRoute;
use api\tests\FunctionalTester;
class RefreshTokenCest {

View File

@ -1,9 +1,9 @@
<?php
namespace tests\codeception\api\functional;
namespace api\tests\functional;
use Codeception\Example;
use tests\codeception\api\_pages\SignupRoute;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\SignupRoute;
use api\tests\FunctionalTester;
class RegisterCest {

View File

@ -1,8 +1,8 @@
<?php
namespace tests\codeception\api\functional;
namespace api\tests\functional;
use tests\codeception\api\_pages\SignupRoute;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\SignupRoute;
use api\tests\FunctionalTester;
class RepeatAccountActivationCest {

View File

@ -1,13 +1,15 @@
<?php
namespace tests\codeception\api\functional\_steps;
declare(strict_types=1);
namespace api\tests\functional\_steps;
use Ramsey\Uuid\Uuid;
use tests\codeception\api\_pages\AuthserverRoute;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\AuthserverRoute;
use api\tests\FunctionalTester;
class AuthserverSteps extends FunctionalTester {
public function amAuthenticated(string $asUsername = 'admin', string $password = 'password_0') {
public function amAuthenticated(string $asUsername = 'admin', string $password = 'password_0'): array {
$route = new AuthserverRoute($this);
$clientToken = Uuid::uuid4()->toString();
$route->authenticate([

View File

@ -1,9 +1,9 @@
<?php
namespace tests\codeception\api\functional\_steps;
namespace api\tests\functional\_steps;
use api\components\OAuth2\Storage\ScopeStorage as S;
use tests\codeception\api\_pages\OauthRoute;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\OauthRoute;
use api\tests\FunctionalTester;
class OauthSteps extends FunctionalTester {

View File

@ -1,10 +1,10 @@
<?php
namespace tests\codeception\api\functional\_steps;
namespace api\tests\functional\_steps;
use common\rbac\Permissions as P;
use Faker\Provider\Uuid;
use tests\codeception\api\_pages\SessionServerRoute;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\SessionServerRoute;
use api\tests\FunctionalTester;
class SessionServerSteps extends FunctionalTester {

View File

@ -1,8 +1,8 @@
<?php
namespace tests\codeception\api\functional\accounts;
namespace api\tests\functional\accounts;
use tests\codeception\api\_pages\AccountsRoute;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\AccountsRoute;
use api\tests\FunctionalTester;
class AcceptRulesCest {

View File

@ -1,10 +1,10 @@
<?php
namespace tests\codeception\api\functional\accounts;
namespace api\tests\functional\accounts;
use common\rbac\Permissions as P;
use tests\codeception\api\_pages\AccountsRoute;
use tests\codeception\api\functional\_steps\OauthSteps;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\AccountsRoute;
use api\tests\functional\_steps\OauthSteps;
use api\tests\FunctionalTester;
class BanCest {

View File

@ -1,8 +1,8 @@
<?php
namespace tests\codeception\api\functional\accounts;
namespace api\tests\functional\accounts;
use tests\codeception\api\_pages\AccountsRoute;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\AccountsRoute;
use api\tests\FunctionalTester;
class ChangeEmailConfirmNewEmailCest {

View File

@ -1,8 +1,8 @@
<?php
namespace tests\codeception\api\functional\accounts;
namespace api\tests\functional\accounts;
use tests\codeception\api\_pages\AccountsRoute;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\AccountsRoute;
use api\tests\FunctionalTester;
class ChangeEmailInitializeCest {

View File

@ -1,9 +1,9 @@
<?php
namespace tests\codeception\api\functional\accounts;
namespace api\tests\functional\accounts;
use tests\codeception\api\_pages\AccountsRoute;
use tests\codeception\api\FunctionalTester;
use tests\codeception\common\helpers\Mock;
use api\tests\_pages\AccountsRoute;
use api\tests\FunctionalTester;
use common\tests\helpers\Mock;
use yii\validators\EmailValidator;
class ChangeEmailSubmitNewEmailCest {

View File

@ -1,8 +1,8 @@
<?php
namespace tests\codeception\api\functional\accounts;
namespace api\tests\functional\accounts;
use tests\codeception\api\_pages\AccountsRoute;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\AccountsRoute;
use api\tests\FunctionalTester;
class ChangeLangCest {

View File

@ -1,11 +1,11 @@
<?php
namespace tests\codeception\api\functional\accounts;
namespace api\tests\functional\accounts;
use common\models\Account;
use tests\codeception\api\_pages\AccountsRoute;
use tests\codeception\api\_pages\AuthenticationRoute;
use tests\codeception\api\functional\_steps\OauthSteps;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\AccountsRoute;
use api\tests\_pages\AuthenticationRoute;
use api\tests\functional\_steps\OauthSteps;
use api\tests\FunctionalTester;
class ChangePasswordCest {

View File

@ -1,10 +1,10 @@
<?php
namespace tests\codeception\api\functional\accounts;
namespace api\tests\functional\accounts;
use common\models\Account;
use tests\codeception\api\_pages\AccountsRoute;
use tests\codeception\api\functional\_steps\OauthSteps;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\AccountsRoute;
use api\tests\functional\_steps\OauthSteps;
use api\tests\FunctionalTester;
class ChangeUsernameCest {

View File

@ -1,9 +1,9 @@
<?php
namespace tests\codeception\api\functional\accounts;
namespace api\tests\functional\accounts;
use OTPHP\TOTP;
use tests\codeception\api\_pages\AccountsRoute;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\AccountsRoute;
use api\tests\FunctionalTester;
class DisableTwoFactorAuthCest {

View File

@ -1,9 +1,9 @@
<?php
namespace tests\codeception\api\functional\accounts;
namespace api\tests\functional\accounts;
use OTPHP\TOTP;
use tests\codeception\api\_pages\AccountsRoute;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\AccountsRoute;
use api\tests\FunctionalTester;
class EnableTwoFactorAuthCest {

View File

@ -1,8 +1,8 @@
<?php
namespace tests\codeception\api\functional\accounts;
namespace api\tests\functional\accounts;
use tests\codeception\api\_pages\AccountsRoute;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\AccountsRoute;
use api\tests\FunctionalTester;
class GetCest {

View File

@ -1,10 +1,10 @@
<?php
namespace tests\codeception\api\functional\accounts;
namespace api\tests\functional\accounts;
use common\rbac\Permissions as P;
use tests\codeception\api\_pages\AccountsRoute;
use tests\codeception\api\functional\_steps\OauthSteps;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\AccountsRoute;
use api\tests\functional\_steps\OauthSteps;
use api\tests\FunctionalTester;
class PardonCest {

View File

@ -1,8 +1,8 @@
<?php
namespace tests\codeception\api\functional\accounts;
namespace api\tests\functional\accounts;
use tests\codeception\api\_pages\AccountsRoute;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\AccountsRoute;
use api\tests\FunctionalTester;
class TwoFactorAuthCredentialsCest {

View File

@ -1,9 +1,9 @@
<?php
namespace tests\codeception\api\functional\authserver;
namespace api\tests\functional\authserver;
use Ramsey\Uuid\Uuid;
use tests\codeception\api\_pages\AuthserverRoute;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\AuthserverRoute;
use api\tests\FunctionalTester;
class AuthorizationCest {

View File

@ -1,9 +1,9 @@
<?php
namespace tests\codeception\api\functional\authserver;
namespace api\tests\functional\authserver;
use Ramsey\Uuid\Uuid;
use tests\codeception\api\_pages\AuthserverRoute;
use tests\codeception\api\functional\_steps\AuthserverSteps;
use api\tests\_pages\AuthserverRoute;
use api\tests\functional\_steps\AuthserverSteps;
class InvalidateCest {

View File

@ -1,9 +1,9 @@
<?php
namespace tests\codeception\api\functional\authserver;
namespace api\tests\functional\authserver;
use Ramsey\Uuid\Uuid;
use tests\codeception\api\_pages\AuthserverRoute;
use tests\codeception\api\functional\_steps\AuthserverSteps;
use api\tests\_pages\AuthserverRoute;
use api\tests\functional\_steps\AuthserverSteps;
class RefreshCest {

View File

@ -1,8 +1,8 @@
<?php
namespace tests\codeception\api\functional\authserver;
namespace api\tests\functional\authserver;
use tests\codeception\api\_pages\AuthserverRoute;
use tests\codeception\api\functional\_steps\AuthserverSteps;
use api\tests\_pages\AuthserverRoute;
use api\tests\functional\_steps\AuthserverSteps;
class SignoutCest {

View File

@ -1,9 +1,9 @@
<?php
namespace tests\codeception\api\functional\authserver;
namespace api\tests\functional\authserver;
use Ramsey\Uuid\Uuid;
use tests\codeception\api\_pages\AuthserverRoute;
use tests\codeception\api\functional\_steps\AuthserverSteps;
use api\tests\_pages\AuthserverRoute;
use api\tests\functional\_steps\AuthserverSteps;
class ValidateCest {

View File

@ -1,9 +1,9 @@
<?php
namespace tests\codeception\api\functional\internal;
namespace api\tests\functional\internal;
use tests\codeception\api\_pages\InternalRoute;
use tests\codeception\api\functional\_steps\OauthSteps;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\InternalRoute;
use api\tests\functional\_steps\OauthSteps;
use api\tests\FunctionalTester;
class InfoCest {

View File

@ -1,8 +1,8 @@
<?php
namespace tests\codeception\api\functional\authserver;
namespace api\tests\functional\authserver;
use tests\codeception\api\_pages\MojangApiRoute;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\MojangApiRoute;
use api\tests\FunctionalTester;
class UsernameToUuidCest {

View File

@ -1,8 +1,8 @@
<?php
namespace tests\codeception\api\functional\authserver;
namespace api\tests\functional\authserver;
use tests\codeception\api\_pages\MojangApiRoute;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\MojangApiRoute;
use api\tests\FunctionalTester;
class UsernamesToUuidsCest {

View File

@ -1,9 +1,9 @@
<?php
namespace tests\codeception\api\functional\authserver;
namespace api\tests\functional\authserver;
use Faker\Provider\Uuid;
use tests\codeception\api\_pages\MojangApiRoute;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\MojangApiRoute;
use api\tests\FunctionalTester;
class UuidToUsernamesHistoryCest {

View File

@ -1,9 +1,9 @@
<?php
namespace tests\codeception\api\oauth;
namespace api\tests\functional\oauth;
use tests\codeception\api\_pages\OauthRoute;
use tests\codeception\api\functional\_steps\OauthSteps;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\OauthRoute;
use api\tests\functional\_steps\OauthSteps;
use api\tests\FunctionalTester;
class AccessTokenCest {
@ -67,6 +67,7 @@ class AccessTokenCest {
'token_type' => 'Bearer',
]);
$I->canSeeResponseJsonMatchesJsonPath('$.access_token');
$I->cantSeeResponseJsonMatchesJsonPath('$.refresh_token');
$I->canSeeResponseJsonMatchesJsonPath('$.expires_in');
}

View File

@ -1,9 +1,9 @@
<?php
namespace tests\codeception\api\oauth;
namespace api\tests\functional\oauth;
use common\rbac\Permissions as P;
use tests\codeception\api\_pages\OauthRoute;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\OauthRoute;
use api\tests\FunctionalTester;
class AuthCodeCest {

View File

@ -1,9 +1,9 @@
<?php
namespace tests\codeception\api\oauth;
namespace api\tests\functional\oauth;
use tests\codeception\api\_pages\OauthRoute;
use tests\codeception\api\functional\_steps\OauthSteps;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\OauthRoute;
use api\tests\functional\_steps\OauthSteps;
use api\tests\FunctionalTester;
class ClientCredentialsCest {

View File

@ -1,8 +1,8 @@
<?php
namespace tests\codeception\api\oauth;
namespace api\tests\functional\oauth;
use tests\codeception\api\_pages\OauthRoute;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\OauthRoute;
use api\tests\FunctionalTester;
class CreateClientCest {

View File

@ -1,8 +1,8 @@
<?php
namespace tests\codeception\api\oauth;
namespace api\tests\functional\oauth;
use tests\codeception\api\_pages\OauthRoute;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\OauthRoute;
use api\tests\FunctionalTester;
class DeleteClientCest {

View File

@ -1,8 +1,8 @@
<?php
namespace tests\codeception\api\oauth;
namespace api\tests\functional\oauth;
use tests\codeception\api\_pages\OauthRoute;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\OauthRoute;
use api\tests\FunctionalTester;
class GetClientsCest {

View File

@ -1,9 +1,9 @@
<?php
namespace codeception\api\functional;
namespace api\tests\functional\oauth;
use tests\codeception\api\_pages\IdentityInfoRoute;
use tests\codeception\api\functional\_steps\OauthSteps;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\IdentityInfoRoute;
use api\tests\functional\_steps\OauthSteps;
use api\tests\FunctionalTester;
class IdentityInfoCest {
@ -16,7 +16,20 @@ class IdentityInfoCest {
$this->route = new IdentityInfoRoute($I);
}
public function testGetErrorIfNoAccessToken(OauthSteps $I) {
$I->wantToTest('behavior when this endpoint called without Authorization header');
$this->route->info();
$I->canSeeResponseCodeIs(401);
$I->canSeeResponseIsJson();
$I->canSeeResponseContainsJson([
'name' => 'Unauthorized',
'status' => 401,
'message' => 'Your request was made with invalid credentials.',
]);
}
public function testGetErrorIfNotEnoughPerms(OauthSteps $I) {
$I->wantToTest('behavior when this endpoint called with token, that have not enough scopes');
$accessToken = $I->getAccessToken();
$I->amBearerAuthenticated($accessToken);
$this->route->info();
@ -25,6 +38,7 @@ class IdentityInfoCest {
$I->canSeeResponseContainsJson([
'name' => 'Forbidden',
'status' => 403,
'message' => 'You are not allowed to perform this action.',
]);
}

View File

@ -1,11 +1,11 @@
<?php
namespace tests\codeception\api\oauth;
namespace api\tests\functional\oauth;
use api\components\OAuth2\Storage\ScopeStorage as S;
use common\rbac\Permissions as P;
use tests\codeception\api\_pages\OauthRoute;
use tests\codeception\api\functional\_steps\OauthSteps;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\OauthRoute;
use api\tests\functional\_steps\OauthSteps;
use api\tests\FunctionalTester;
class RefreshTokenCest {

View File

@ -1,8 +1,8 @@
<?php
namespace tests\codeception\api\oauth;
namespace api\tests\functional\oauth;
use tests\codeception\api\_pages\OauthRoute;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\OauthRoute;
use api\tests\FunctionalTester;
class ResetClientCest {

View File

@ -1,8 +1,8 @@
<?php
namespace tests\codeception\api\oauth;
namespace api\tests\functional\oauth;
use tests\codeception\api\_pages\OauthRoute;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\OauthRoute;
use api\tests\FunctionalTester;
class UpdateClientCest {

View File

@ -1,10 +1,10 @@
<?php
namespace tests\codeception\api\functional\sessionserver;
namespace api\tests\functional\sessionserver;
use Faker\Provider\Uuid;
use tests\codeception\api\_pages\SessionServerRoute;
use tests\codeception\api\functional\_steps\SessionServerSteps;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\SessionServerRoute;
use api\tests\functional\_steps\SessionServerSteps;
use api\tests\FunctionalTester;
class HasJoinedCest {

View File

@ -1,10 +1,10 @@
<?php
namespace tests\codeception\api\functional\sessionserver;
namespace api\tests\functional\sessionserver;
use Faker\Provider\Uuid;
use tests\codeception\api\_pages\SessionServerRoute;
use tests\codeception\api\functional\_steps\SessionServerSteps;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\SessionServerRoute;
use api\tests\functional\_steps\SessionServerSteps;
use api\tests\FunctionalTester;
class HasJoinedLegacyCest {

View File

@ -1,12 +1,12 @@
<?php
namespace tests\codeception\api\functional\sessionserver;
namespace api\tests\functional\sessionserver;
use common\rbac\Permissions as P;
use Faker\Provider\Uuid;
use tests\codeception\api\_pages\SessionServerRoute;
use tests\codeception\api\functional\_steps\AuthserverSteps;
use tests\codeception\api\functional\_steps\OauthSteps;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\SessionServerRoute;
use api\tests\functional\_steps\AuthserverSteps;
use api\tests\functional\_steps\OauthSteps;
use api\tests\FunctionalTester;
class JoinCest {

View File

@ -1,12 +1,12 @@
<?php
namespace tests\codeception\api\functional\sessionserver;
namespace api\tests\functional\sessionserver;
use common\rbac\Permissions as P;
use Faker\Provider\Uuid;
use tests\codeception\api\_pages\SessionServerRoute;
use tests\codeception\api\functional\_steps\AuthserverSteps;
use tests\codeception\api\functional\_steps\OauthSteps;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\SessionServerRoute;
use api\tests\functional\_steps\AuthserverSteps;
use api\tests\functional\_steps\OauthSteps;
use api\tests\FunctionalTester;
class JoinLegacyCest {

View File

@ -1,10 +1,10 @@
<?php
namespace tests\codeception\api\functional\sessionserver;
namespace api\tests\functional\sessionserver;
use Faker\Provider\Uuid;
use tests\codeception\api\_pages\SessionServerRoute;
use tests\codeception\api\functional\_steps\SessionServerSteps;
use tests\codeception\api\FunctionalTester;
use api\tests\_pages\SessionServerRoute;
use api\tests\functional\_steps\SessionServerSteps;
use api\tests\FunctionalTester;
class ProfileCest {

View File

@ -0,0 +1,10 @@
suite_namespace: api\tests\unit
actor: UnitTester
modules:
enabled:
- Asserts
- Yii2:
part: [orm, email, fixtures]
configFile: tests/config/unit.php
- common\tests\_support\queue\CodeceptionQueueHelper
- common\tests\_support\Mockery

View File

@ -1,12 +1,12 @@
<?php
namespace tests\codeception\api\unit;
namespace api\tests\unit;
use Mockery;
class TestCase extends \Codeception\Test\Unit {
/**
* @var \tests\codeception\api\UnitTester
* @var \api\tests\UnitTester
*/
protected $tester;

View File

@ -7,7 +7,7 @@ use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Psr7\Response;
use phpmock\mockery\PHPMockery;
use ReflectionClass;
use tests\codeception\api\unit\TestCase;
use api\tests\unit\TestCase;
class ValidatorTest extends TestCase {

View File

@ -9,11 +9,11 @@ use common\models\AccountSession;
use Emarref\Jwt\Claim;
use Emarref\Jwt\Jwt;
use Emarref\Jwt\Token;
use tests\codeception\api\unit\TestCase;
use tests\codeception\common\_support\ProtectedCaller;
use tests\codeception\common\fixtures\AccountFixture;
use tests\codeception\common\fixtures\AccountSessionFixture;
use tests\codeception\common\fixtures\MinecraftAccessKeyFixture;
use api\tests\unit\TestCase;
use common\tests\_support\ProtectedCaller;
use common\tests\fixtures\AccountFixture;
use common\tests\fixtures\AccountSessionFixture;
use common\tests\fixtures\MinecraftAccessKeyFixture;
use Yii;
use yii\web\Request;

View File

@ -1,5 +1,5 @@
<?php
namespace tests\codeception\api\unit\components\User;
namespace api\tests\unit\components\User;
use api\components\User\AuthenticationResult;
use common\models\Account;
@ -9,7 +9,7 @@ use Emarref\Jwt\Claim\Expiration;
use Emarref\Jwt\Encryption\Factory as EncryptionFactory;
use Emarref\Jwt\Jwt;
use Emarref\Jwt\Token;
use tests\codeception\api\unit\TestCase;
use api\tests\unit\TestCase;
class JwtAuthenticationResultTest extends TestCase {

View File

@ -1,8 +1,8 @@
<?php
namespace tests\codeception\api\unit\filters;
namespace api\tests\unit\filters;
use api\filters\NginxCache;
use tests\codeception\api\unit\TestCase;
use api\tests\unit\TestCase;
use Yii;
use yii\base\Action;
use yii\web\Controller;

View File

@ -3,7 +3,7 @@ namespace codeception\api\unit\models;
use api\models\FeedbackForm;
use common\models\Account;
use tests\codeception\api\unit\TestCase;
use api\tests\unit\TestCase;
use yii\swiftmailer\Message;
class FeedbackFormTest extends TestCase {

View File

@ -8,9 +8,9 @@ use Codeception\Specify;
use Emarref\Jwt\Claim;
use Emarref\Jwt\Encryption\Factory as EncryptionFactory;
use Emarref\Jwt\Token;
use tests\codeception\api\unit\TestCase;
use tests\codeception\common\_support\ProtectedCaller;
use tests\codeception\common\fixtures\AccountFixture;
use api\tests\unit\TestCase;
use common\tests\_support\ProtectedCaller;
use common\tests\fixtures\AccountFixture;
use Yii;
class JwtIdentityTest extends TestCase {

View File

@ -1,13 +1,13 @@
<?php
namespace tests\codeception\api\models\authentication;
namespace api\tests\_support\models\authentication;
use api\components\User\AuthenticationResult;
use api\models\authentication\ConfirmEmailForm;
use common\models\Account;
use common\models\AccountSession;
use common\models\EmailActivation;
use tests\codeception\api\unit\TestCase;
use tests\codeception\common\fixtures\EmailActivationFixture;
use api\tests\unit\TestCase;
use common\tests\fixtures\EmailActivationFixture;
class ConfirmEmailFormTest extends TestCase {

View File

@ -8,9 +8,9 @@ use common\models\Account;
use common\models\EmailActivation;
use common\tasks\SendPasswordRecoveryEmail;
use GuzzleHttp\ClientInterface;
use tests\codeception\api\unit\TestCase;
use tests\codeception\common\fixtures\AccountFixture;
use tests\codeception\common\fixtures\EmailActivationFixture;
use api\tests\unit\TestCase;
use common\tests\fixtures\AccountFixture;
use common\tests\fixtures\EmailActivationFixture;
use Yii;
class ForgotPasswordFormTest extends TestCase {

View File

@ -1,13 +1,13 @@
<?php
namespace tests\codeception\api\models\authentication;
namespace api\tests\_support\models\authentication;
use api\components\User\AuthenticationResult;
use api\models\authentication\LoginForm;
use Codeception\Specify;
use common\models\Account;
use OTPHP\TOTP;
use tests\codeception\api\unit\TestCase;
use tests\codeception\common\fixtures\AccountFixture;
use api\tests\unit\TestCase;
use common\tests\fixtures\AccountFixture;
class LoginFormTest extends TestCase {
use Specify;

View File

@ -1,12 +1,12 @@
<?php
namespace tests\codeception\api\models\authentication;
namespace api\tests\_support\models\authentication;
use api\components\User\Component;
use api\components\User\Identity;
use api\models\authentication\LogoutForm;
use Codeception\Specify;
use common\models\AccountSession;
use tests\codeception\api\unit\TestCase;
use api\tests\unit\TestCase;
use Yii;
class LogoutFormTest extends TestCase {

View File

@ -1,13 +1,13 @@
<?php
namespace tests\codeception\api\models\authentication;
namespace api\tests\_support\models\authentication;
use api\components\User\AuthenticationResult;
use api\models\authentication\RecoverPasswordForm;
use Codeception\Specify;
use common\models\Account;
use common\models\EmailActivation;
use tests\codeception\api\unit\TestCase;
use tests\codeception\common\fixtures\EmailActivationFixture;
use api\tests\unit\TestCase;
use common\tests\fixtures\EmailActivationFixture;
class RecoverPasswordFormTest extends TestCase {
use Specify;

View File

@ -5,8 +5,8 @@ use api\components\User\AuthenticationResult;
use api\models\authentication\RefreshTokenForm;
use Codeception\Specify;
use common\models\AccountSession;
use tests\codeception\api\unit\TestCase;
use tests\codeception\common\fixtures\AccountSessionFixture;
use api\tests\unit\TestCase;
use common\tests\fixtures\AccountSessionFixture;
class RefreshTokenFormTest extends TestCase {
use Specify;

View File

@ -1,26 +1,24 @@
<?php
namespace tests\codeception\api\models\authentication;
namespace api\tests\_support\models\authentication;
use api\components\ReCaptcha\Validator as ReCaptchaValidator;
use api\models\authentication\RegistrationForm;
use Codeception\Specify;
use common\models\Account;
use common\models\EmailActivation;
use common\models\UsernameHistory;
use common\tasks\SendRegistrationEmail;
use GuzzleHttp\ClientInterface;
use tests\codeception\api\unit\TestCase;
use tests\codeception\common\fixtures\AccountFixture;
use tests\codeception\common\fixtures\EmailActivationFixture;
use tests\codeception\common\fixtures\UsernameHistoryFixture;
use tests\codeception\common\helpers\Mock;
use api\tests\unit\TestCase;
use common\tests\fixtures\AccountFixture;
use common\tests\fixtures\EmailActivationFixture;
use common\tests\fixtures\UsernameHistoryFixture;
use common\tests\helpers\Mock;
use Yii;
use yii\validators\EmailValidator;
use yii\web\Request;
use const common\LATEST_RULES_VERSION;
class RegistrationFormTest extends TestCase {
use Specify;
public function setUp() {
parent::setUp();
@ -132,9 +130,8 @@ class RegistrationFormTest extends TestCase {
->getMock();
$request
->expects($this->any())
->method('getUserIP')
->will($this->returnValue($ip));
->willReturn($ip);
Yii::$app->set('request', $request);

View File

@ -1,5 +1,5 @@
<?php
namespace tests\codeception\api\models\authentication;
namespace api\tests\_support\models\authentication;
use api\components\ReCaptcha\Validator as ReCaptchaValidator;
use api\models\authentication\RepeatAccountActivationForm;
@ -7,9 +7,9 @@ use Codeception\Specify;
use common\models\EmailActivation;
use common\tasks\SendRegistrationEmail;
use GuzzleHttp\ClientInterface;
use tests\codeception\api\unit\TestCase;
use tests\codeception\common\fixtures\AccountFixture;
use tests\codeception\common\fixtures\EmailActivationFixture;
use api\tests\unit\TestCase;
use common\tests\fixtures\AccountFixture;
use common\tests\fixtures\EmailActivationFixture;
use Yii;
class RepeatAccountActivationFormTest extends TestCase {

View File

@ -1,8 +1,8 @@
<?php
namespace tests\codeception\api\models\base;
namespace api\tests\_support\models\base;
use api\models\base\ApiForm;
use tests\codeception\api\unit\TestCase;
use api\tests\unit\TestCase;
class ApiFormTest extends TestCase {

View File

@ -1,9 +1,9 @@
<?php
namespace tests\codeception\api\unit\modules\accounts\models;
namespace api\tests\unit\modules\accounts\models;
use api\modules\accounts\models\AcceptRulesForm;
use common\models\Account;
use tests\codeception\api\unit\TestCase;
use api\tests\unit\TestCase;
use const common\LATEST_RULES_VERSION;
class AcceptRulesFormTest extends TestCase {

View File

@ -1,12 +1,12 @@
<?php
namespace tests\codeception\api\unit\modules\accounts\models;
namespace api\tests\unit\modules\accounts\models;
use api\modules\accounts\models\ChangeEmailForm;
use common\models\Account;
use common\models\EmailActivation;
use tests\codeception\api\unit\TestCase;
use tests\codeception\common\fixtures\AccountFixture;
use tests\codeception\common\fixtures\EmailActivationFixture;
use api\tests\unit\TestCase;
use common\tests\fixtures\AccountFixture;
use common\tests\fixtures\EmailActivationFixture;
class ChangeEmailFormTest extends TestCase {

Some files were not shown because too many files have changed in this diff Show More