mirror of
https://github.com/elyby/accounts.git
synced 2025-01-12 06:52:04 +05:30
Восстановлен запуск тестов
Загрузчик конфигов выделен в отдельный класс authserverHost выделена в params Исправлены некоторые common.unit тесты, т.к. наследовались не от того базового класса
This commit is contained in:
parent
54485b2271
commit
df6d319187
@ -1,3 +1,4 @@
|
||||
<?php
|
||||
return [
|
||||
'authserverHost' => getenv('AUTHSERVER_HOST'),
|
||||
];
|
||||
|
@ -25,7 +25,7 @@ class SessionController extends ApiController {
|
||||
$behaviors['rateLimiting'] = [
|
||||
'class' => RateLimiter::class,
|
||||
'only' => ['has-joined', 'has-joined-legacy'],
|
||||
'authserverDomain' => getenv('AUTHSERVER_HOST'),
|
||||
'authserverDomain' => Yii::$app->params['authserverHost'],
|
||||
];
|
||||
|
||||
return $behaviors;
|
||||
|
@ -41,8 +41,7 @@ class RateLimiter extends \yii\filters\RateLimiter {
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function checkRateLimit($user, $request, $response, $action) {
|
||||
// TODO: теперь в authserverDomain хранится hostname без schema, а getHostInfo() возвращает с http(s).
|
||||
if ($request->getHostInfo() === $this->authserverDomain) {
|
||||
if (parse_url($request->getHostInfo(), PHP_URL_HOST) === $this->authserverDomain) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3,14 +3,12 @@ require __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
defined('YII_DEBUG') or define('YII_DEBUG', (boolean)getenv('YII_DEBUG'));
|
||||
defined('YII_ENV') or define('YII_ENV', getenv('YII_ENV'));
|
||||
defined('YII_APPLICATION_TYPE') or define('YII_APPLICATION_TYPE', 'web');
|
||||
defined('YII_APPLICATION_MODULE') or define('YII_APPLICATION_MODULE', 'api');
|
||||
|
||||
require __DIR__ . '/../../vendor/yiisoft/yii2/Yii.php';
|
||||
require __DIR__ . '/../../common/config/bootstrap.php';
|
||||
require __DIR__ . '/../config/bootstrap.php';
|
||||
|
||||
$config = require __DIR__ . './../../common/config/config-loader.php';
|
||||
$config = \common\config\ConfigLoader::load('api');
|
||||
|
||||
$application = new yii\web\Application($config);
|
||||
$application->run();
|
||||
|
2
common/config/.gitignore
vendored
2
common/config/.gitignore
vendored
@ -1 +1 @@
|
||||
main-local.php
|
||||
config-local.php
|
||||
|
65
common/config/ConfigLoader.php
Normal file
65
common/config/ConfigLoader.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
namespace common\config;
|
||||
|
||||
use yii\helpers\ArrayHelper;
|
||||
|
||||
class ConfigLoader {
|
||||
|
||||
/*
|
||||
* TODO: В PHP 7.1 следует сделать её protected
|
||||
*/
|
||||
const ROOT_PATH = __DIR__ . '/../..';
|
||||
|
||||
private $application;
|
||||
|
||||
public function __construct(string $application) {
|
||||
$this->application = $application;
|
||||
}
|
||||
|
||||
public function getEnvironment() : string {
|
||||
return YII_ENV;
|
||||
}
|
||||
|
||||
public function getConfig() : array {
|
||||
$toMerge = [
|
||||
require __DIR__ . '/config.php',
|
||||
];
|
||||
|
||||
// Общие окружение-зависимые настройки
|
||||
$path = __DIR__ . '/config-' . YII_ENV . '.php';
|
||||
if (file_exists($path)) {
|
||||
$toMerge[] = require $path;
|
||||
}
|
||||
|
||||
// Общие локальные настройки
|
||||
$path = __DIR__ . '/config-local.php';
|
||||
if (file_exists($path)) {
|
||||
$toMerge[] = require $path;
|
||||
}
|
||||
|
||||
// Настройки конкретного приложения
|
||||
$path = self::ROOT_PATH . '/' . $this->application . '/config/config.php';
|
||||
if (file_exists($path)) {
|
||||
$toMerge[] = require $path;
|
||||
}
|
||||
|
||||
// Настройки конкретного приложения для действующего окружения
|
||||
$path = self::ROOT_PATH . '/' . $this->application . '/config/main-' . YII_ENV . '.php';
|
||||
if (file_exists($path)) {
|
||||
$toMerge[] = require $path;
|
||||
}
|
||||
|
||||
// Локальные настройки конкретного приложения
|
||||
$path = self::ROOT_PATH . '/' . $this->application . '/config/config-local.php';
|
||||
if (file_exists($path)) {
|
||||
$toMerge[] = require $path;
|
||||
}
|
||||
|
||||
return ArrayHelper::merge(...$toMerge);
|
||||
}
|
||||
|
||||
public static function load(string $application) : array {
|
||||
return (new static($application))->getConfig();
|
||||
}
|
||||
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
<?php
|
||||
use yii\helpers\ArrayHelper;
|
||||
|
||||
$rootPath = __DIR__ . '/../..';
|
||||
|
||||
$toMerge = [
|
||||
require __DIR__ . '/main.php',
|
||||
];
|
||||
|
||||
// Общие окружение-зависимые настройки
|
||||
$path = __DIR__ . '/common-' . YII_ENV . '.php';
|
||||
if (file_exists($path)) {
|
||||
$toMerge[] = require $path;
|
||||
}
|
||||
|
||||
// Общие локальные настройки
|
||||
$path = __DIR__ . '/common-local.php';
|
||||
if (file_exists($path)) {
|
||||
$toMerge[] = require $path;
|
||||
}
|
||||
|
||||
// Настройки конкретного приложения
|
||||
$path = $rootPath . '/' . YII_APPLICATION_MODULE . '/config/main.php';
|
||||
if (file_exists($path)) {
|
||||
$toMerge[] = require $path;
|
||||
}
|
||||
|
||||
// Настройки конкретного приложения для действующего окружения
|
||||
$path = $rootPath . '/' . YII_APPLICATION_MODULE . '/config/main-' . YII_ENV . '.php';
|
||||
if (file_exists($path)) {
|
||||
$toMerge[] = require $path;
|
||||
}
|
||||
|
||||
// Локальные настройки конкретного приложения
|
||||
$path = $rootPath . '/' . YII_APPLICATION_MODULE . '/config/main-local.php';
|
||||
if (file_exists($path)) {
|
||||
$toMerge[] = require $path;
|
||||
}
|
||||
|
||||
// не оставляем глобальных переменных, ну кроме $toMerge, хех
|
||||
unset($path, $rootPath);
|
||||
|
||||
return ArrayHelper::merge(...$toMerge);
|
@ -1,24 +1,26 @@
|
||||
<?php
|
||||
use Codeception\Configuration;
|
||||
use Codeception\Specify\Config;
|
||||
|
||||
defined('YII_DEBUG') or define('YII_DEBUG', true);
|
||||
defined('YII_ENV') or define('YII_ENV', 'test');
|
||||
defined('YII_ENV_TEST') or define('YII_ENV_TEST', true);
|
||||
defined('YII_ENV') or define('YII_ENV', 'dev');
|
||||
|
||||
defined('YII_APP_BASE_PATH') or define('YII_APP_BASE_PATH', dirname(dirname(dirname(__DIR__))));
|
||||
defined('API_ENTRY_URL') or define('API_ENTRY_URL', parse_url(Configuration::config()['config']['test_entry_url'], PHP_URL_PATH));
|
||||
defined('API_ENTRY_FILE') or define('API_ENTRY_FILE', __DIR__ . '/../../../api/web/index.php');
|
||||
|
||||
defined('API_ENTRY_URL') or define('API_ENTRY_URL', parse_url(\Codeception\Configuration::config()['config']['test_entry_url'], PHP_URL_PATH));
|
||||
defined('API_ENTRY_FILE') or define('API_ENTRY_FILE', YII_APP_BASE_PATH . '/api/web/index-test.php');
|
||||
|
||||
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(YII_APP_BASE_PATH . '/api/config/bootstrap.php');
|
||||
require_once __DIR__ . '/../../../vendor/autoload.php';
|
||||
require_once __DIR__ . '/../../../vendor/yiisoft/yii2/Yii.php';
|
||||
require_once __DIR__ . '/../../../common/config/bootstrap.php';
|
||||
require_once __DIR__ . '/../../../api/config/bootstrap.php';
|
||||
|
||||
// set correct script paths
|
||||
|
||||
// the entry script file path for functional tests
|
||||
$_SERVER['SCRIPT_FILENAME'] = API_ENTRY_FILE;
|
||||
$_SERVER['SCRIPT_NAME'] = API_ENTRY_URL;
|
||||
$_SERVER['SERVER_NAME'] = parse_url(\Codeception\Configuration::config()['config']['test_entry_url'], PHP_URL_HOST);
|
||||
$_SERVER['SERVER_PORT'] = parse_url(\Codeception\Configuration::config()['config']['test_entry_url'], PHP_URL_PORT) ?: '80';
|
||||
$_SERVER['SERVER_NAME'] = parse_url(Configuration::config()['config']['test_entry_url'], PHP_URL_HOST);
|
||||
$_SERVER['SERVER_PORT'] = parse_url(Configuration::config()['config']['test_entry_url'], PHP_URL_PORT) ?: '80';
|
||||
|
||||
Yii::setAlias('@tests', dirname(dirname(__DIR__)));
|
||||
\Codeception\Specify\Config::setDeepClone(false);
|
||||
Config::setDeepClone(false);
|
||||
|
@ -12,9 +12,7 @@ settings:
|
||||
memory_limit: 1024M
|
||||
log: true
|
||||
config:
|
||||
# the entry script URL (with host info) for functional tests
|
||||
# PLEASE ADJUST IT TO THE ACTUAL ENTRY SCRIPT URL
|
||||
test_entry_url: http://localhost:8080/api/web/index-test.php
|
||||
test_entry_url: http://localhost:8080/api/web/index.php
|
||||
coverage:
|
||||
enabled: true
|
||||
remote: true
|
||||
@ -26,4 +24,4 @@ coverage:
|
||||
- ../../../api/mails/*
|
||||
- ../../../api/web/*
|
||||
- ../../../api/runtime/*
|
||||
c3url: 'http://localhost:8080/api/web/index-test.php'
|
||||
c3url: 'http://localhost:8080/api/web/index.php'
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
new yii\web\Application(require(dirname(dirname(__DIR__)) . '/config/api/functional.php'));
|
||||
new yii\web\Application(require __DIR__ . '/../../config/api/functional.php');
|
||||
|
||||
\Codeception\Util\Autoload::registerSuffix('Steps', __DIR__ . DIRECTORY_SEPARATOR);
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace tests\codeception\api\models\authentication;
|
||||
|
||||
use api\components\ReCaptcha\Validator;
|
||||
use api\models\authentication\RegistrationForm;
|
||||
use Codeception\Specify;
|
||||
use common\models\Account;
|
||||
@ -25,6 +26,11 @@ class RegistrationFormTest extends DbTestCase {
|
||||
return 'testing_message.eml';
|
||||
};
|
||||
$this->mockRequest();
|
||||
Yii::$container->set(Validator::class, new class extends Validator {
|
||||
public function validateValue($value) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected function tearDown() {
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace tests\codeception\api\models\authentication;
|
||||
|
||||
use api\components\ReCaptcha\Validator;
|
||||
use api\models\authentication\RepeatAccountActivationForm;
|
||||
use Codeception\Specify;
|
||||
use common\models\EmailActivation;
|
||||
@ -23,6 +24,11 @@ class RepeatAccountActivationFormTest extends DbTestCase {
|
||||
$mailer->fileTransportCallback = function () {
|
||||
return 'testing_message.eml';
|
||||
};
|
||||
Yii::$container->set(Validator::class, new class extends Validator {
|
||||
public function validateValue($value) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected function tearDown() {
|
||||
|
@ -24,6 +24,9 @@ class RateLimiterTest extends TestCase {
|
||||
|
||||
/** @var RateLimiter|\PHPUnit_Framework_MockObject_MockObject $filter */
|
||||
$filter = $this->getMockBuilder(RateLimiter::class)
|
||||
->setConstructorArgs([[
|
||||
'authserverDomain' => Yii::$app->params['authserverHost']
|
||||
]])
|
||||
->setMethods(['getServer'])
|
||||
->getMock();
|
||||
|
||||
@ -54,7 +57,9 @@ class RateLimiterTest extends TestCase {
|
||||
->method('getHostInfo')
|
||||
->will($this->returnValue('http://authserver.ely.by'));
|
||||
|
||||
$filter = new RateLimiter();
|
||||
$filter = new RateLimiter([
|
||||
'authserverDomain' => Yii::$app->params['authserverHost']
|
||||
]);
|
||||
$filter->checkRateLimit(null, $request, null, null);
|
||||
}
|
||||
|
||||
@ -86,6 +91,7 @@ class RateLimiterTest extends TestCase {
|
||||
$filter = $this->getMockBuilder(RateLimiter::class)
|
||||
->setConstructorArgs([[
|
||||
'limit' => 3,
|
||||
'authserverDomain' => Yii::$app->params['authserverHost'],
|
||||
]])
|
||||
->setMethods(['getServer'])
|
||||
->getMock();
|
||||
|
@ -1,19 +1,10 @@
|
||||
<?php
|
||||
/**
|
||||
* Yii console bootstrap file.
|
||||
*
|
||||
* @link http://www.yiiframework.com/
|
||||
* @copyright Copyright (c) 2008 Yii Software LLC
|
||||
* @license http://www.yiiframework.com/license/
|
||||
*/
|
||||
|
||||
defined('YII_DEBUG') or define('YII_DEBUG', true);
|
||||
defined('YII_ENV') or define('YII_ENV', 'test');
|
||||
defined('YII_ENV_TEST') or define('YII_ENV_TEST', true);
|
||||
defined('YII_ENV') or define('YII_ENV', 'dev');
|
||||
|
||||
defined('YII_APP_BASE_PATH') or define('YII_APP_BASE_PATH', dirname(dirname(dirname(__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__ . '/../../../vendor/autoload.php';
|
||||
require_once __DIR__ . '/../../../vendor/yiisoft/yii2/Yii.php';
|
||||
require_once __DIR__ . '/../../../common/config/bootstrap.php';
|
||||
|
||||
Yii::setAlias('@tests', dirname(dirname(__DIR__)));
|
||||
|
@ -1,21 +1,10 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/**
|
||||
* Yii console bootstrap file.
|
||||
*
|
||||
* @link http://www.yiiframework.com/
|
||||
* @copyright Copyright (c) 2008 Yii Software LLC
|
||||
* @license http://www.yiiframework.com/license/
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/_bootstrap.php';
|
||||
|
||||
$config = yii\helpers\ArrayHelper::merge(
|
||||
require(YII_APP_BASE_PATH . '/common/config/main.php'),
|
||||
require(YII_APP_BASE_PATH . '/common/config/main-local.php'),
|
||||
require(YII_APP_BASE_PATH . '/console/config/main.php'),
|
||||
require(YII_APP_BASE_PATH . '/console/config/main-local.php'),
|
||||
require(dirname(__DIR__) . '/config/config.php')
|
||||
\common\config\ConfigLoader::load('console'),
|
||||
require(__DIR__ . '/../config/config.php')
|
||||
);
|
||||
|
||||
$application = new yii\console\Application($config);
|
||||
|
@ -1,20 +0,0 @@
|
||||
@echo off
|
||||
|
||||
rem -------------------------------------------------------------
|
||||
rem Yii command line bootstrap script for Windows.
|
||||
rem
|
||||
rem @author Qiang Xue <qiang.xue@gmail.com>
|
||||
rem @link http://www.yiiframework.com/
|
||||
rem @copyright Copyright (c) 2008 Yii Software LLC
|
||||
rem @license http://www.yiiframework.com/license/
|
||||
rem -------------------------------------------------------------
|
||||
|
||||
@setlocal
|
||||
|
||||
set YII_PATH=%~dp0
|
||||
|
||||
if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe
|
||||
|
||||
"%PHP_COMMAND%" "%YII_PATH%yii" %*
|
||||
|
||||
@endlocal
|
@ -1,12 +1,11 @@
|
||||
<?php
|
||||
defined('YII_DEBUG') or define('YII_DEBUG', true);
|
||||
defined('YII_ENV') or define('YII_ENV', 'test');
|
||||
defined('YII_ENV_TEST') or define('YII_ENV_TEST', true);
|
||||
defined('YII_ENV') or define('YII_ENV', 'dev');
|
||||
|
||||
defined('YII_APP_BASE_PATH') or define('YII_APP_BASE_PATH', dirname(dirname(dirname(__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__ . '/../../../vendor/autoload.php';
|
||||
require_once __DIR__ . '/../../../vendor/yiisoft/yii2/Yii.php';
|
||||
require_once __DIR__ . '/../../../common/config/bootstrap.php';
|
||||
|
||||
// set correct script paths
|
||||
$_SERVER['SERVER_NAME'] = 'localhost';
|
||||
|
@ -3,7 +3,7 @@ namespace codeception\common\unit\behaviors;
|
||||
|
||||
use Codeception\Specify;
|
||||
use common\behaviors\PrimaryKeyValueBehavior;
|
||||
use tests\codeception\api\unit\TestCase;
|
||||
use tests\codeception\common\unit\TestCase;
|
||||
use yii\db\ActiveRecord;
|
||||
|
||||
class PrimaryKeyValueBehaviorTest extends TestCase {
|
||||
|
@ -6,7 +6,7 @@ use common\models\confirmations\ForgotPassword;
|
||||
use common\models\confirmations\RegistrationConfirmation;
|
||||
use common\models\EmailActivation;
|
||||
use tests\codeception\common\fixtures\EmailActivationFixture;
|
||||
use tests\codeception\console\unit\DbTestCase;
|
||||
use tests\codeception\common\unit\DbTestCase;
|
||||
|
||||
class EmailActivationTest extends DbTestCase {
|
||||
use Specify;
|
||||
|
@ -10,6 +10,6 @@ return [
|
||||
],
|
||||
],
|
||||
'params' => [
|
||||
'authserverDomain' => 'http://authserver.ely.by',
|
||||
'authserverHost' => 'authserver.ely.by',
|
||||
],
|
||||
];
|
||||
|
@ -2,16 +2,9 @@
|
||||
$_SERVER['SCRIPT_FILENAME'] = API_ENTRY_FILE;
|
||||
$_SERVER['SCRIPT_NAME'] = API_ENTRY_URL;
|
||||
|
||||
/**
|
||||
* Application configuration for api functional tests
|
||||
*/
|
||||
return yii\helpers\ArrayHelper::merge(
|
||||
require(YII_APP_BASE_PATH . '/common/config/main.php'),
|
||||
require(YII_APP_BASE_PATH . '/common/config/main-local.php'), require(YII_APP_BASE_PATH . '/api/config/main.php'),
|
||||
require(YII_APP_BASE_PATH . '/api/config/main-local.php'),
|
||||
require(dirname(__DIR__) . '/config.php'),
|
||||
require(dirname(__DIR__) . '/functional.php'),
|
||||
require(__DIR__ . '/config.php'),
|
||||
[
|
||||
]
|
||||
\common\config\ConfigLoader::load('api'),
|
||||
require __DIR__ . '/../config.php',
|
||||
require __DIR__ . '/../functional.php',
|
||||
require __DIR__ . '/config.php'
|
||||
);
|
||||
|
@ -1,15 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Application configuration for api unit tests
|
||||
*/
|
||||
return yii\helpers\ArrayHelper::merge(
|
||||
require(YII_APP_BASE_PATH . '/common/config/main.php'),
|
||||
require(YII_APP_BASE_PATH . '/common/config/main-local.php'), require(YII_APP_BASE_PATH . '/api/config/main.php'),
|
||||
require(YII_APP_BASE_PATH . '/api/config/main-local.php'),
|
||||
require(dirname(__DIR__) . '/config.php'),
|
||||
require(dirname(__DIR__) . '/unit.php'),
|
||||
require(__DIR__ . '/config.php'),
|
||||
[
|
||||
]
|
||||
\common\config\ConfigLoader::load('api'),
|
||||
require __DIR__ . '/../config.php',
|
||||
require __DIR__ . '/../unit.php',
|
||||
require __DIR__ . '/config.php'
|
||||
);
|
||||
|
@ -1,12 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Application config for common unit tests
|
||||
*/
|
||||
return yii\helpers\ArrayHelper::merge(
|
||||
require(YII_APP_BASE_PATH . '/common/config/main.php'),
|
||||
require(YII_APP_BASE_PATH . '/common/config/main-local.php'),
|
||||
require(dirname(__DIR__) . '/config.php'),
|
||||
require(dirname(__DIR__) . '/unit.php'),
|
||||
\common\config\ConfigLoader::load('common'),
|
||||
require __DIR__ . '/../config.php',
|
||||
require __DIR__ . '/../unit.php',
|
||||
[
|
||||
'id' => 'app-common',
|
||||
'basePath' => dirname(__DIR__),
|
||||
|
@ -3,7 +3,7 @@ return [
|
||||
'language' => 'en-US',
|
||||
'controllerMap' => [
|
||||
'fixture' => [
|
||||
'class' => 'yii\faker\FixtureController',
|
||||
'class' => yii\faker\FixtureController::class,
|
||||
'fixtureDataPath' => '@tests/codeception/common/fixtures/data',
|
||||
'templatePath' => '@tests/codeception/common/templates/fixtures',
|
||||
'namespace' => 'tests\codeception\common\fixtures',
|
||||
|
@ -1,14 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Application configuration for console unit tests
|
||||
*/
|
||||
return yii\helpers\ArrayHelper::merge(
|
||||
require(YII_APP_BASE_PATH . '/common/config/main.php'),
|
||||
require(YII_APP_BASE_PATH . '/common/config/main-local.php'),
|
||||
require(YII_APP_BASE_PATH . '/console/config/main.php'),
|
||||
require(YII_APP_BASE_PATH . '/console/config/main-local.php'),
|
||||
require(dirname(__DIR__) . '/config.php'),
|
||||
require(dirname(__DIR__) . '/unit.php'),
|
||||
[
|
||||
]
|
||||
\common\config\ConfigLoader::load('console'),
|
||||
require __DIR__ . '/../config.php',
|
||||
require __DIR__ . '/../unit.php'
|
||||
);
|
||||
|
@ -1,18 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* Application configuration shared by all applications functional tests
|
||||
*/
|
||||
return [
|
||||
'components' => [
|
||||
'request' => [
|
||||
// it's not recommended to run functional tests with CSRF validation enabled
|
||||
// TODO: у нас вроде и без того нет проверки csrf
|
||||
'enableCsrfValidation' => false,
|
||||
'enableCookieValidation' => false,
|
||||
// but if you absolutely need it set cookie domain to localhost
|
||||
/*
|
||||
'csrfCookie' => [
|
||||
'domain' => 'localhost',
|
||||
],
|
||||
*/
|
||||
],
|
||||
],
|
||||
];
|
||||
];
|
||||
|
@ -1,7 +1,4 @@
|
||||
<?php
|
||||
/**
|
||||
* Application configuration shared by all applications unit tests
|
||||
*/
|
||||
return [
|
||||
|
||||
];
|
||||
];
|
||||
|
@ -1,13 +1,12 @@
|
||||
<?php
|
||||
defined('YII_DEBUG') or define('YII_DEBUG', true);
|
||||
defined('YII_ENV') or define('YII_ENV', 'test');
|
||||
defined('YII_ENV_TEST') or define('YII_ENV_TEST', true);
|
||||
defined('YII_ENV') or define('YII_ENV', 'dev');
|
||||
|
||||
defined('YII_APP_BASE_PATH') or define('YII_APP_BASE_PATH', dirname(dirname(dirname(__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(YII_APP_BASE_PATH . '/console/config/bootstrap.php');
|
||||
require_once __DIR__ . '/../../../vendor/autoload.php';
|
||||
require_once __DIR__ . '/../../../vendor/yiisoft/yii2/Yii.php';
|
||||
require_once __DIR__ . '/../../../common/config/bootstrap.php';
|
||||
require_once __DIR__ . '/../../../console/config/bootstrap.php';
|
||||
|
||||
// set correct script paths
|
||||
$_SERVER['SERVER_NAME'] = 'localhost';
|
||||
|
4
yii
4
yii
@ -4,14 +4,12 @@ require(__DIR__ . '/vendor/autoload.php');
|
||||
|
||||
defined('YII_DEBUG') or define('YII_DEBUG', (boolean)getenv('YII_DEBUG'));
|
||||
defined('YII_ENV') or define('YII_ENV', getenv('YII_ENV'));
|
||||
defined('YII_APPLICATION_TYPE') or define('YII_APPLICATION_TYPE', 'cli');
|
||||
defined('YII_APPLICATION_MODULE') or define('YII_APPLICATION_MODULE', 'console');
|
||||
|
||||
require(__DIR__ . '/vendor/yiisoft/yii2/Yii.php');
|
||||
require(__DIR__ . '/common/config/bootstrap.php');
|
||||
require(__DIR__ . '/console/config/bootstrap.php');
|
||||
|
||||
$config = require __DIR__ . '/common/config/config-loader.php';
|
||||
$config = \common\config\ConfigLoader::load('console');
|
||||
|
||||
$application = new yii\console\Application($config);
|
||||
$exitCode = $application->run();
|
||||
|
Loading…
x
Reference in New Issue
Block a user