Commit c33214b3 by Alexander Makarov

Adjusted test configs structure

parent 28091ed2
<?php <?php
new yii\web\Application(require(dirname(dirname(__DIR__)) . '/config/backend/acceptance.php'));
new yii\web\Application(require(__DIR__ . '/_config.php'));
...@@ -14,4 +14,4 @@ modules: ...@@ -14,4 +14,4 @@ modules:
- codeception\common\_support\FixtureHelper - codeception\common\_support\FixtureHelper
config: config:
Yii2: Yii2:
configFile: 'functional/_config.php' configFile: '../config/backend/functional.php'
<?php <?php
new yii\web\Application(require(dirname(dirname(__DIR__)) . '/config/backend/functional.php'));
new yii\web\Application(require(__DIR__ . '/_config.php'));
...@@ -4,5 +4,5 @@ namespace backend\tests\unit; ...@@ -4,5 +4,5 @@ namespace backend\tests\unit;
class DbTestCase extends \yii\codeception\DbTestCase class DbTestCase extends \yii\codeception\DbTestCase
{ {
public $appConfig = '@backend/tests/unit/_config.php'; public $appConfig = '@codeception/config/backend/unit.php';
} }
...@@ -4,5 +4,5 @@ namespace backend\tests\unit; ...@@ -4,5 +4,5 @@ namespace backend\tests\unit;
class TestCase extends \yii\codeception\TestCase class TestCase extends \yii\codeception\TestCase
{ {
public $appConfig = '@backend/tests/unit/_config.php'; public $appConfig = '@codeception/config/backend/unit.php';
} }
...@@ -8,19 +8,15 @@ ...@@ -8,19 +8,15 @@
* @license http://www.yiiframework.com/license/ * @license http://www.yiiframework.com/license/
*/ */
require_once __DIR__ . '/_console_bootstrap.php'; require_once __DIR__ . '/_bootstrap.php';
$config = yii\helpers\ArrayHelper::merge( $config = yii\helpers\ArrayHelper::merge(
require(ROOT_DIR . '/common/config/main.php'), require(ROOT_DIR . '/common/config/main.php'),
require(ROOT_DIR . '/common/config/main-local.php'), require(ROOT_DIR . '/common/config/main-local.php'),
require(ROOT_DIR . '/console/config/main.php'), require(ROOT_DIR . '/console/config/main.php'),
require(ROOT_DIR . '/console/config/main-local.php'), require(ROOT_DIR . '/console/config/main-local.php'),
require(dirname(__DIR__) . '/config/acceptance.php'),
[ [
'components' => [
'db' => [
'dsn' => 'mysql:host=localhost;dbname=yii2_advanced_acceptance',
],
],
'controllerMap' => [ 'controllerMap' => [
'fixture' => [ 'fixture' => [
'class' => 'yii\faker\FixtureController', 'class' => 'yii\faker\FixtureController',
......
...@@ -8,19 +8,15 @@ ...@@ -8,19 +8,15 @@
* @license http://www.yiiframework.com/license/ * @license http://www.yiiframework.com/license/
*/ */
require_once __DIR__ . '/_console_bootstrap.php'; require_once __DIR__ . '/_bootstrap.php';
$config = yii\helpers\ArrayHelper::merge( $config = yii\helpers\ArrayHelper::merge(
require(ROOT_DIR . '/common/config/main.php'), require(ROOT_DIR . '/common/config/main.php'),
require(ROOT_DIR . '/common/config/main-local.php'), require(ROOT_DIR . '/common/config/main-local.php'),
require(ROOT_DIR . '/console/config/main.php'), require(ROOT_DIR . '/console/config/main.php'),
require(ROOT_DIR . '/console/config/main-local.php'), require(ROOT_DIR . '/console/config/main-local.php'),
require(dirname(__DIR__) . '/config/functional.php'),
[ [
'components' => [
'db' => [
'dsn' => 'mysql:host=localhost;dbname=yii2_advanced_functional',
],
],
'controllerMap' => [ 'controllerMap' => [
'fixture' => [ 'fixture' => [
'class' => 'yii\faker\FixtureController', 'class' => 'yii\faker\FixtureController',
......
...@@ -8,19 +8,15 @@ ...@@ -8,19 +8,15 @@
* @license http://www.yiiframework.com/license/ * @license http://www.yiiframework.com/license/
*/ */
require_once __DIR__ . '/_console_bootstrap.php'; require_once __DIR__ . '/_bootstrap.php';
$config = yii\helpers\ArrayHelper::merge( $config = yii\helpers\ArrayHelper::merge(
require(ROOT_DIR . '/common/config/main.php'), require(ROOT_DIR . '/common/config/main.php'),
require(ROOT_DIR . '/common/config/main-local.php'), require(ROOT_DIR . '/common/config/main-local.php'),
require(ROOT_DIR . '/console/config/main.php'), require(ROOT_DIR . '/console/config/main.php'),
require(ROOT_DIR . '/console/config/main-local.php'), require(ROOT_DIR . '/console/config/main-local.php'),
require(dirname(__DIR__) . '/config/unit.php'),
[ [
'components' => [
'db' => [
'dsn' => 'mysql:host=localhost;dbname=yii2_advanced_unit',
],
],
'controllerMap' => [ 'controllerMap' => [
'fixture' => [ 'fixture' => [
'class' => 'yii\faker\FixtureController', 'class' => 'yii\faker\FixtureController',
......
...@@ -7,5 +7,5 @@ namespace codeception\common\unit; ...@@ -7,5 +7,5 @@ namespace codeception\common\unit;
*/ */
class DbTestCase extends \yii\codeception\DbTestCase class DbTestCase extends \yii\codeception\DbTestCase
{ {
public $appConfig = '@codeception/common/unit/_config.php'; public $appConfig = '@codeception/config/common/unit.php';
} }
...@@ -7,5 +7,5 @@ namespace common\tests\unit; ...@@ -7,5 +7,5 @@ namespace common\tests\unit;
*/ */
class TestCase extends \yii\codeception\TestCase class TestCase extends \yii\codeception\TestCase
{ {
public $appConfig = '@common/tests/unit/_config.php'; public $appConfig = '@codeception/config/common/unit.php';
} }
<?php <?php
/** /**
* application configurations shared by all test types * Application configuration shared by all applications acceptance tests
*/ */
return [ return [
'components' => [ 'components' => [
'mailer' => [ 'db' => [
'useFileTransport' => true, 'dsn' => 'mysql:host=localhost;dbname=yii2_advanced_acceptance',
],
'urlManager' => [
'showScriptName' => true,
], ],
], ],
]; ];
\ No newline at end of file
<?php <?php
defined('ROOT_DIR') or define('ROOT_DIR', dirname(dirname(dirname(dirname(__DIR__))))); defined('ROOT_DIR') or define('ROOT_DIR', dirname(dirname(dirname(dirname(__DIR__)))));
return yii\helpers\ArrayHelper::merge( return yii\helpers\ArrayHelper::merge(
require(ROOT_DIR . '/backend/config/main.php'),
require(ROOT_DIR . '/backend/config/main-local.php'),
require(ROOT_DIR . '/common/config/main.php'), require(ROOT_DIR . '/common/config/main.php'),
require(ROOT_DIR . '/common/config/main-local.php'), require(ROOT_DIR . '/common/config/main-local.php'),
require(__DIR__ . '/../_config.php'), require(ROOT_DIR . '/backend/config/main.php'),
require(ROOT_DIR . '/backend/config/main-local.php'),
require(dirname(__DIR__) . '/config.php'),
require(dirname(__DIR__) . '/acceptance.php'),
require(__DIR__ . '/config.php'),
[ [
'components' => [
'db' => [
'dsn' => 'mysql:host=localhost;dbname=yii2_advanced_acceptance',
],
],
] ]
); );
<?php
return [];
\ No newline at end of file
...@@ -7,12 +7,9 @@ return yii\helpers\ArrayHelper::merge( ...@@ -7,12 +7,9 @@ return yii\helpers\ArrayHelper::merge(
require(ROOT_DIR . '/backend/config/main-local.php'), require(ROOT_DIR . '/backend/config/main-local.php'),
require(ROOT_DIR . '/common/config/main.php'), require(ROOT_DIR . '/common/config/main.php'),
require(ROOT_DIR . '/common/config/main-local.php'), require(ROOT_DIR . '/common/config/main-local.php'),
require(__DIR__ . '/../_config.php'), require(dirname(__DIR__) . '/config.php'),
require(dirname(__DIR__) . '/functional.php'),
require(__DIR__ . '/config.php'),
[ [
'components' => [
'db' => [
'dsn' => 'mysql:host=localhost;dbname=yii2_advanced_functional',
],
],
] ]
); );
...@@ -5,12 +5,9 @@ return yii\helpers\ArrayHelper::merge( ...@@ -5,12 +5,9 @@ return yii\helpers\ArrayHelper::merge(
require(ROOT_DIR . '/common/config/main-local.php'), require(ROOT_DIR . '/common/config/main-local.php'),
require(ROOT_DIR . '/backend/config/main.php'), require(ROOT_DIR . '/backend/config/main.php'),
require(ROOT_DIR . '/backend/config/main-local.php'), require(ROOT_DIR . '/backend/config/main-local.php'),
require(dirname(__DIR__) . '/_config.php'), require(dirname(__DIR__) . '/config.php'),
require(dirname(__DIR__) . '/unit.php'),
require(__DIR__ . '/config.php'),
[ [
'components' => [
'db' => [
'dsn' => 'mysql:host=localhost;dbname=yii2_advanced_unit',
],
],
] ]
); );
<?php <?php
/**
* Application config for common unit tests
*/
return yii\helpers\ArrayHelper::merge( return yii\helpers\ArrayHelper::merge(
require(ROOT_DIR . '/common/config/main.php'), require(ROOT_DIR . '/common/config/main.php'),
require(ROOT_DIR . '/common/config/main-local.php'), require(ROOT_DIR . '/common/config/main-local.php'),
require(__DIR__ . '/../_config.php'), require(dirname(__DIR__) . '/config.php'),
require(dirname(__DIR__) . '/unit.php'),
[ [
'components' => [
'db' => [
'dsn' => 'mysql:host=localhost;dbname=yii2_advanced_unit',
],
],
'id' => 'app-common', 'id' => 'app-common',
'basePath' => dirname(__DIR__), 'basePath' => dirname(__DIR__),
] ]
......
<?php <?php
/** /**
* application configurations shared by all test types * Application configuration shared by all applications and test types
*/ */
return [ return [
'components' => [ 'components' => [
......
<?php
return yii\helpers\ArrayHelper::merge(
require(ROOT_DIR . '/common/config/main.php'),
require(ROOT_DIR . '/common/config/main-local.php'),
require(ROOT_DIR . '/console/config/main.php'),
require(ROOT_DIR . '/console/config/main-local.php'),
require(dirname(__DIR__) . '/config.php'),
require(dirname(__DIR__) . '/unit.php'),
[
]
);
<?php <?php
defined('ROOT_DIR') or define('ROOT_DIR', dirname(dirname(dirname(dirname(__DIR__))))); defined('ROOT_DIR') or define('ROOT_DIR', dirname(dirname(dirname(dirname(__DIR__)))));
return yii\helpers\ArrayHelper::merge( return yii\helpers\ArrayHelper::merge(
require(ROOT_DIR . '/frontend/config/main.php'),
require(ROOT_DIR . '/frontend/config/main-local.php'),
require(ROOT_DIR . '/common/config/main.php'), require(ROOT_DIR . '/common/config/main.php'),
require(ROOT_DIR . '/common/config/main-local.php'), require(ROOT_DIR . '/common/config/main-local.php'),
require(__DIR__ . '/../_config.php'), require(ROOT_DIR . '/frontend/config/main.php'),
require(ROOT_DIR . '/frontend/config/main-local.php'),
require(dirname(__DIR__) . '/config.php'),
require(dirname(__DIR__) . '/acceptance.php'),
require(__DIR__ . '/config.php'),
[ [
'components' => [
'db' => [
'dsn' => 'mysql:host=localhost;dbname=yii2_advanced_acceptance',
],
],
] ]
); );
<?php
return [];
\ No newline at end of file
...@@ -3,16 +3,13 @@ $_SERVER['SCRIPT_FILENAME'] = FRONTEND_ENTRY_FILE; ...@@ -3,16 +3,13 @@ $_SERVER['SCRIPT_FILENAME'] = FRONTEND_ENTRY_FILE;
$_SERVER['SCRIPT_NAME'] = FRONTEND_ENTRY_URL; $_SERVER['SCRIPT_NAME'] = FRONTEND_ENTRY_URL;
return yii\helpers\ArrayHelper::merge( return yii\helpers\ArrayHelper::merge(
require(ROOT_DIR . '/frontend/config/main.php'),
require(ROOT_DIR . '/frontend/config/main-local.php'),
require(ROOT_DIR . '/common/config/main.php'), require(ROOT_DIR . '/common/config/main.php'),
require(ROOT_DIR . '/common/config/main-local.php'), require(ROOT_DIR . '/common/config/main-local.php'),
require(__DIR__ . '/../_config.php'), require(ROOT_DIR . '/frontend/config/main.php'),
require(ROOT_DIR . '/frontend/config/main-local.php'),
require(dirname(__DIR__) . '/config.php'),
require(dirname(__DIR__) . '/functional.php'),
require(__DIR__ . '/config.php'),
[ [
'components' => [
'db' => [
'dsn' => 'mysql:host=localhost;dbname=yii2_advanced_functional',
],
],
] ]
); );
...@@ -5,12 +5,9 @@ return yii\helpers\ArrayHelper::merge( ...@@ -5,12 +5,9 @@ return yii\helpers\ArrayHelper::merge(
require(ROOT_DIR . '/common/config/main-local.php'), require(ROOT_DIR . '/common/config/main-local.php'),
require(ROOT_DIR . '/frontend/config/main.php'), require(ROOT_DIR . '/frontend/config/main.php'),
require(ROOT_DIR . '/frontend/config/main-local.php'), require(ROOT_DIR . '/frontend/config/main-local.php'),
require(__DIR__ . '/../_config.php'), require(dirname(__DIR__) . '/config.php'),
require(dirname(__DIR__) . '/unit.php'),
require(__DIR__ . '/config.php'),
[ [
'components' => [
'db' => [
'dsn' => 'mysql:host=localhost;dbname=yii2_advanced_unit',
],
],
] ]
); );
<?php <?php
/** /**
* application configurations shared by all test types * Application configuration shared by all applications functional tests
*/ */
return [ return [
'components' => [ 'components' => [
'mailer' => [ 'db' => [
'useFileTransport' => true, 'dsn' => 'mysql:host=localhost;dbname=yii2_advanced_acceptance',
],
'urlManager' => [
'showScriptName' => true,
], ],
], ],
]; ];
\ No newline at end of file
<?php <?php
/** /**
* application configurations shared by all test types * Application configuration shared by all applications unit tests
*/ */
return [ return [
'components' => [ 'components' => [
'mailer' => [ 'db' => [
'useFileTransport' => true, 'dsn' => 'mysql:host=localhost;dbname=yii2_advanced_unit',
],
'urlManager' => [
'showScriptName' => true,
], ],
], ],
]; ];
\ No newline at end of file
...@@ -7,5 +7,5 @@ namespace console\tests\unit; ...@@ -7,5 +7,5 @@ namespace console\tests\unit;
*/ */
class DbTestCase extends \yii\codeception\DbTestCase class DbTestCase extends \yii\codeception\DbTestCase
{ {
public $appConfig = '@console/tests/unit/_config.php'; public $appConfig = '@codeception/config/console/config.php';
} }
...@@ -7,5 +7,5 @@ namespace console\tests\unit; ...@@ -7,5 +7,5 @@ namespace console\tests\unit;
*/ */
class TestCase extends \yii\codeception\TestCase class TestCase extends \yii\codeception\TestCase
{ {
public $appConfig = '@console/tests/unit/_config.php'; public $appConfig = '@codeception/config/console/config.php';
} }
<?php
return yii\helpers\ArrayHelper::merge(
require(__DIR__ . '/../../../common/config/main.php'),
require(__DIR__ . '/../../../common/config/main-local.php'),
require(__DIR__ . '/../../config/main.php'),
require(__DIR__ . '/../../config/main-local.php'),
require(__DIR__ . '/../_config.php'),
[
'components' => [
'db' => [
'dsn' => 'mysql:host=localhost;dbname=yii2_advanced_unit',
],
],
]
);
<?php <?php
new yii\web\Application(require(dirname(dirname(__DIR__)) . '/config/frontend/acceptance.php'));
new yii\web\Application(require(__DIR__ . '/_config.php'));
...@@ -14,4 +14,4 @@ modules: ...@@ -14,4 +14,4 @@ modules:
- codeception\common\_support\FixtureHelper - codeception\common\_support\FixtureHelper
config: config:
Yii2: Yii2:
configFile: 'functional/_config.php' configFile: '../config/frontend/functional.php'
<?php <?php
new yii\web\Application(require(__DIR__ . '/_config.php')); new yii\web\Application(require(dirname(dirname(__DIR__)) . '/config/frontend/functional.php'));
...@@ -7,5 +7,5 @@ namespace codeception\frontend\unit; ...@@ -7,5 +7,5 @@ namespace codeception\frontend\unit;
*/ */
class DbTestCase extends \yii\codeception\DbTestCase class DbTestCase extends \yii\codeception\DbTestCase
{ {
public $appConfig = '@codeception/frontend/unit/_config.php'; public $appConfig = '@codeception/config/frontend/unit.php';
} }
...@@ -7,5 +7,5 @@ namespace codeception\frontend\unit; ...@@ -7,5 +7,5 @@ namespace codeception\frontend\unit;
*/ */
class TestCase extends \yii\codeception\TestCase class TestCase extends \yii\codeception\TestCase
{ {
public $appConfig = '@codeception/frontend/unit/_config.php'; public $appConfig = '@codeception/config/frontend/unit.php';
} }
<?php <?php
new yii\web\Application(require(dirname(__DIR__) . '/config/acceptance.php'));
new yii\web\Application(require(__DIR__ . '/_config.php'));
<?php <?php
defined('YII_DEBUG') or define('YII_DEBUG', true); defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'test'); defined('YII_ENV') or define('YII_ENV', 'test');
// fcgi doesn't have STDIN and STDOUT defined by default // fcgi doesn't have STDIN and STDOUT defined by default
......
...@@ -8,11 +8,11 @@ ...@@ -8,11 +8,11 @@
* @license http://www.yiiframework.com/license/ * @license http://www.yiiframework.com/license/
*/ */
require_once __DIR__ . '/_console_bootstrap.php'; require_once __DIR__ . '/_bootstrap.php';
$config = yii\helpers\ArrayHelper::merge( $config = yii\helpers\ArrayHelper::merge(
require(ROOT_DIR . '/config/console.php'), require(ROOT_DIR . '/config/console.php'),
require(__DIR__ . '/../_config.php'), require(__DIR__ . '/../config/config.php'),
[ [
'components' => [ 'components' => [
'db' => [ 'db' => [
......
...@@ -8,11 +8,11 @@ ...@@ -8,11 +8,11 @@
* @license http://www.yiiframework.com/license/ * @license http://www.yiiframework.com/license/
*/ */
require_once __DIR__ . '/_console_bootstrap.php'; require_once __DIR__ . '/_bootstrap.php';
$config = yii\helpers\ArrayHelper::merge( $config = yii\helpers\ArrayHelper::merge(
require(ROOT_DIR . '/config/console.php'), require(ROOT_DIR . '/config/console.php'),
require(__DIR__ . '/../_config.php'), require(__DIR__ . '/../config/config.php'),
[ [
'components' => [ 'components' => [
'db' => [ 'db' => [
......
...@@ -8,11 +8,11 @@ ...@@ -8,11 +8,11 @@
* @license http://www.yiiframework.com/license/ * @license http://www.yiiframework.com/license/
*/ */
require_once __DIR__ . '/_console_bootstrap.php'; require_once __DIR__ . '/_bootstrap.php';
$config = yii\helpers\ArrayHelper::merge( $config = yii\helpers\ArrayHelper::merge(
require(ROOT_DIR . '/config/console.php'), require(ROOT_DIR . '/config/console.php'),
require(__DIR__ . '/../_config.php'), require(__DIR__ . '/../config/config.php'),
[ [
'components' => [ 'components' => [
'db' => [ 'db' => [
......
<?php <?php
/**
* Application configuration for acceptance tests
*/
return yii\helpers\ArrayHelper::merge( return yii\helpers\ArrayHelper::merge(
require(__DIR__ . '/../../../config/web.php'), require(__DIR__ . '/../../../config/web.php'),
require(__DIR__ . '/../_config.php'), require(__DIR__ . '/config.php'),
[ [
'components' => [ 'components' => [
'db' => [ 'db' => [
......
<?php <?php
/** /**
* application configurations shared by all test types * Application configuration shared by all test types
*/ */
return [ return [
'components' => [ 'components' => [
......
...@@ -2,9 +2,12 @@ ...@@ -2,9 +2,12 @@
$_SERVER['SCRIPT_FILENAME'] = TEST_ENTRY_FILE; $_SERVER['SCRIPT_FILENAME'] = TEST_ENTRY_FILE;
$_SERVER['SCRIPT_NAME'] = TEST_ENTRY_URL; $_SERVER['SCRIPT_NAME'] = TEST_ENTRY_URL;
/**
* Application configuration for functional tests
*/
return yii\helpers\ArrayHelper::merge( return yii\helpers\ArrayHelper::merge(
require(__DIR__ . '/../../../config/web.php'), require(__DIR__ . '/../../../config/web.php'),
require(__DIR__ . '/../_config.php'), require(__DIR__ . '/config.php'),
[ [
'components' => [ 'components' => [
'db' => [ 'db' => [
......
<?php <?php
/**
* Application configuration for unit tests
*/
return yii\helpers\ArrayHelper::merge( return yii\helpers\ArrayHelper::merge(
require(__DIR__ . '/../../../config/web.php'), require(__DIR__ . '/../../../config/web.php'),
require(__DIR__ . '/../_config.php'), require(__DIR__ . '/config.php'),
[ [
'components' => [ 'components' => [
'db' => [ 'db' => [
......
...@@ -13,4 +13,4 @@ modules: ...@@ -13,4 +13,4 @@ modules:
- Yii2 - Yii2
config: config:
Yii2: Yii2:
configFile: 'codeception/functional/_config.php' configFile: 'codeception/config/functional.php'
<?php <?php
new yii\web\Application(require(dirname(__DIR__) . '/config/functional.php'));
new yii\web\Application(require(__DIR__ . '/_config.php'));
...@@ -11,6 +11,6 @@ defined('YII_ENV') or define('YII_ENV', 'test'); ...@@ -11,6 +11,6 @@ defined('YII_ENV') or define('YII_ENV', 'test');
require(__DIR__ . '/../vendor/autoload.php'); require(__DIR__ . '/../vendor/autoload.php');
require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php'); require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php');
$config = require(__DIR__ . '/../tests/codeception/acceptance/_config.php'); $config = require(__DIR__ . '/../tests/codeception/config/acceptance.php');
(new yii\web\Application($config))->run(); (new yii\web\Application($config))->run();
...@@ -31,7 +31,7 @@ class TestCase extends Test ...@@ -31,7 +31,7 @@ class TestCase extends Test
* The application configuration array may contain an optional `class` element which specifies the class * The application configuration array may contain an optional `class` element which specifies the class
* name of the application instance to be created. By default, a [[\yii\web\Application]] instance will be created. * name of the application instance to be created. By default, a [[\yii\web\Application]] instance will be created.
*/ */
public $appConfig = '@codeception/unit/_config.php'; public $appConfig = '@codeception/config/unit.php';
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment