Commit c0a83142 by Alexander Makarov

Exposed basic app entry URL via codeception.yml, refactored configs of advanced…

Exposed basic app entry URL via codeception.yml, refactored configs of advanced app to read from config and define entry script in a single place
parent cef430af
<?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');
defined('ROOT_DIR') or define('ROOT_DIR', dirname(dirname(dirname(__DIR__)))); defined('ROOT_DIR') or define('ROOT_DIR', dirname(dirname(dirname(__DIR__))));
defined('BACKEND_ENTRY_URL') or define('BACKEND_ENTRY_URL', \Codeception\Configuration::config()['config']['test_entry_url']);
defined('BACKEND_ENTRY_FILE') or define('BACKEND_ENTRY_FILE', ROOT_DIR . '/backend/web/index-test.php');
require_once(ROOT_DIR . '/vendor/autoload.php'); require_once(ROOT_DIR . '/vendor/autoload.php');
require_once(ROOT_DIR . '/vendor/yiisoft/yii2/Yii.php'); require_once(ROOT_DIR . '/vendor/yiisoft/yii2/Yii.php');
require(ROOT_DIR . '/common/config/aliases.php'); require(ROOT_DIR . '/common/config/aliases.php');
...@@ -13,8 +14,8 @@ require(ROOT_DIR . '/common/config/aliases.php'); ...@@ -13,8 +14,8 @@ require(ROOT_DIR . '/common/config/aliases.php');
// set correct script paths // set correct script paths
// the entry script file path for functional and acceptance tests // the entry script file path for functional and acceptance tests
$_SERVER['SCRIPT_FILENAME'] = ROOT_DIR . '/backend/web/index-test.php'; $_SERVER['SCRIPT_FILENAME'] = BACKEND_ENTRY_FILE;
$_SERVER['SCRIPT_NAME'] = \Codeception\Configuration::config()['config']['test_entry_url']; $_SERVER['SCRIPT_NAME'] = BACKEND_ENTRY_URL;
$_SERVER['SERVER_NAME'] = 'localhost'; $_SERVER['SERVER_NAME'] = 'localhost';
Yii::setAlias('@codeception', dirname(__DIR__)); Yii::setAlias('@codeception', dirname(__DIR__));
<?php <?php
$_SERVER['SCRIPT_FILENAME'] = BACKEND_ENTRY_FILE;
// set correct script paths $_SERVER['SCRIPT_NAME'] = BACKEND_ENTRY_URL;
$_SERVER['SCRIPT_FILENAME'] = ROOT_DIR. '/backend/web/index-test.php';
$_SERVER['SCRIPT_NAME'] = \Codeception\Configuration::config()['config']['test_entry_url'];;
return yii\helpers\ArrayHelper::merge( return yii\helpers\ArrayHelper::merge(
require(ROOT_DIR . '/backend/config/main.php'), require(ROOT_DIR . '/backend/config/main.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');
defined('ROOT_DIR') or define('ROOT_DIR', dirname(dirname(dirname(__DIR__)))); defined('ROOT_DIR') or define('ROOT_DIR', dirname(dirname(dirname(__DIR__))));
......
<?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');
defined('ROOT_DIR') or define('ROOT_DIR', dirname(dirname(dirname(__DIR__)))); defined('ROOT_DIR') or define('ROOT_DIR', dirname(dirname(dirname(__DIR__))));
......
<?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');
defined('ROOT_DIR') or define('ROOT_DIR', dirname(dirname(dirname(__DIR__)))); defined('ROOT_DIR') or define('ROOT_DIR', dirname(dirname(dirname(__DIR__))));
defined('FRONTEND_ENTRY_URL') or define('FRONTEND_ENTRY_URL', \Codeception\Configuration::config()['config']['test_entry_url']);
defined('FRONTEND_ENTRY_FILE') or define('FRONTEND_ENTRY_FILE', ROOT_DIR . '/frontend/web/index-test.php');
require_once(ROOT_DIR . '/vendor/autoload.php'); require_once(ROOT_DIR . '/vendor/autoload.php');
require_once(ROOT_DIR . '/vendor/yiisoft/yii2/Yii.php'); require_once(ROOT_DIR . '/vendor/yiisoft/yii2/Yii.php');
require(ROOT_DIR . '/common/config/aliases.php'); require(ROOT_DIR . '/common/config/aliases.php');
...@@ -13,8 +14,8 @@ require(ROOT_DIR . '/common/config/aliases.php'); ...@@ -13,8 +14,8 @@ require(ROOT_DIR . '/common/config/aliases.php');
// set correct script paths // set correct script paths
// the entry script file path for functional and acceptance tests // the entry script file path for functional and acceptance tests
$_SERVER['SCRIPT_FILENAME'] = ROOT_DIR . '/frontend/web/index-test.php'; $_SERVER['SCRIPT_FILENAME'] = FRONTEND_ENTRY_FILE;
$_SERVER['SCRIPT_NAME'] = \Codeception\Configuration::config()['config']['test_entry_url']; $_SERVER['SCRIPT_NAME'] = FRONTEND_ENTRY_URL;
$_SERVER['SERVER_NAME'] = 'localhost'; $_SERVER['SERVER_NAME'] = 'localhost';
Yii::setAlias('@codeception', dirname(__DIR__)); Yii::setAlias('@codeception', dirname(__DIR__));
\ No newline at end of file
<?php <?php
$_SERVER['SCRIPT_FILENAME'] = FRONTEND_ENTRY_FILE;
// set correct script paths $_SERVER['SCRIPT_NAME'] = FRONTEND_ENTRY_URL;
$_SERVER['SCRIPT_FILENAME'] = ROOT_DIR . '/frontend/web/index-test.php';
$_SERVER['SCRIPT_NAME'] = \Codeception\Configuration::config()['config']['test_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.php'),
......
...@@ -10,3 +10,7 @@ settings: ...@@ -10,3 +10,7 @@ settings:
memory_limit: 1024M memory_limit: 1024M
log: true log: true
colors: true colors: true
config:
# the entry script URL (without host info) for functional and acceptance tests
# PLEASE ADJUST IT TO THE ACTUAL ENTRY SCRIPT URL
test_entry_url: /index-test.php
\ No newline at end of file
<?php <?php
// the entry script URL (without host info) for functional and acceptance tests
// PLEASE ADJUST IT TO THE ACTUAL ENTRY SCRIPT URL
defined('TEST_ENTRY_URL') or define('TEST_ENTRY_URL', '/index-test.php');
// the entry script file path for functional and acceptance tests
defined('TEST_ENTRY_FILE') or define('TEST_ENTRY_FILE', dirname(dirname(__DIR__)) . '/web/index-test.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');
require_once(__DIR__ . '/../../vendor/autoload.php'); defined('TEST_ENTRY_URL') or define('TEST_ENTRY_URL', \Codeception\Configuration::config()['config']['test_entry_url']);
defined('TEST_ENTRY_FILE') or define('TEST_ENTRY_FILE', dirname(dirname(__DIR__)) . '/web/index-test.php');
require_once(__DIR__ . '/../../vendor/autoload.php');
require_once(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php'); require_once(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php');
// set correct script paths
$_SERVER['SCRIPT_FILENAME'] = TEST_ENTRY_FILE; $_SERVER['SCRIPT_FILENAME'] = TEST_ENTRY_FILE;
$_SERVER['SCRIPT_NAME'] = TEST_ENTRY_URL; $_SERVER['SCRIPT_NAME'] = TEST_ENTRY_URL;
$_SERVER['SERVER_NAME'] = 'localhost'; $_SERVER['SERVER_NAME'] = 'localhost';
......
<?php <?php
// set correct script paths
$_SERVER['SCRIPT_FILENAME'] = TEST_ENTRY_FILE; $_SERVER['SCRIPT_FILENAME'] = TEST_ENTRY_FILE;
$_SERVER['SCRIPT_NAME'] = TEST_ENTRY_URL; $_SERVER['SCRIPT_NAME'] = TEST_ENTRY_URL;
......
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