mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-10 23:50:38 +08:00
Fixes #6103: Improved codeception config in app templates to ease testing of advanced app on multiple hosts
This commit is contained in:
committed by
Alexander Makarov
parent
af50f5a290
commit
6c88467ac4
@@ -4,7 +4,7 @@ defined('YII_ENV') or define('YII_ENV', 'test');
|
||||
|
||||
defined('YII_APP_BASE_PATH') or define('YII_APP_BASE_PATH', dirname(dirname(dirname(__DIR__))));
|
||||
|
||||
defined('YII_BACKEND_TEST_ENTRY_URL') or define('YII_BACKEND_TEST_ENTRY_URL', \Codeception\Configuration::config()['config']['test_entry_url']);
|
||||
defined('YII_BACKEND_TEST_ENTRY_URL') or define('YII_BACKEND_TEST_ENTRY_URL', parse_url(\Codeception\Configuration::config()['config']['test_entry_url'], PHP_URL_PATH));
|
||||
defined('YII_TEST_BACKEND_ENTRY_FILE') or define('YII_TEST_BACKEND_ENTRY_FILE', YII_APP_BASE_PATH . '/backend/web/index-test.php');
|
||||
|
||||
require_once(YII_APP_BASE_PATH . '/vendor/autoload.php');
|
||||
@@ -17,6 +17,7 @@ require_once(YII_APP_BASE_PATH . '/backend/config/bootstrap.php');
|
||||
// the entry script file path for functional and acceptance tests
|
||||
$_SERVER['SCRIPT_FILENAME'] = YII_TEST_BACKEND_ENTRY_FILE;
|
||||
$_SERVER['SCRIPT_NAME'] = YII_BACKEND_TEST_ENTRY_URL;
|
||||
$_SERVER['SERVER_NAME'] = 'localhost';
|
||||
$_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';
|
||||
|
||||
Yii::setAlias('@tests', dirname(dirname(__DIR__)));
|
||||
|
||||
@@ -20,8 +20,9 @@ modules:
|
||||
# - WebDriver
|
||||
config:
|
||||
PhpBrowser:
|
||||
url: 'http://localhost:8080'
|
||||
# PLEASE ADJUST IT TO THE ACTUAL ENTRY POINT WITHOUT PATH INFO
|
||||
url: http://localhost:8080
|
||||
# WebDriver:
|
||||
# url: 'http://localhost'
|
||||
# url: http://localhost:8080
|
||||
# browser: firefox
|
||||
# restart: true
|
||||
|
||||
@@ -12,6 +12,6 @@ settings:
|
||||
memory_limit: 1024M
|
||||
log: true
|
||||
config:
|
||||
# the entry script URL (without host info) for functional and acceptance tests
|
||||
# the entry script URL (with host info) for functional and acceptance tests
|
||||
# PLEASE ADJUST IT TO THE ACTUAL ENTRY SCRIPT URL
|
||||
test_entry_url: /backend/web/index-test.php
|
||||
test_entry_url: http://localhost:8080/backend/web/index-test.php
|
||||
|
||||
@@ -10,5 +10,6 @@ require_once(YII_APP_BASE_PATH . '/common/config/bootstrap.php');
|
||||
|
||||
// set correct script paths
|
||||
$_SERVER['SERVER_NAME'] = 'localhost';
|
||||
$_SERVER['SERVER_PORT'] = '80';
|
||||
|
||||
Yii::setAlias('@tests', dirname(dirname(__DIR__)));
|
||||
|
||||
@@ -11,5 +11,6 @@ require_once(YII_APP_BASE_PATH . '/console/config/bootstrap.php');
|
||||
|
||||
// set correct script paths
|
||||
$_SERVER['SERVER_NAME'] = 'localhost';
|
||||
$_SERVER['SERVER_PORT'] = '80';
|
||||
|
||||
Yii::setAlias('@tests', dirname(dirname(__DIR__)));
|
||||
|
||||
@@ -4,7 +4,7 @@ defined('YII_ENV') or define('YII_ENV', 'test');
|
||||
|
||||
defined('YII_APP_BASE_PATH') or define('YII_APP_BASE_PATH', dirname(dirname(dirname(__DIR__))));
|
||||
|
||||
defined('FRONTEND_ENTRY_URL') or define('FRONTEND_ENTRY_URL', \Codeception\Configuration::config()['config']['test_entry_url']);
|
||||
defined('FRONTEND_ENTRY_URL') or define('FRONTEND_ENTRY_URL', parse_url(\Codeception\Configuration::config()['config']['test_entry_url'], PHP_URL_PATH));
|
||||
defined('FRONTEND_ENTRY_FILE') or define('FRONTEND_ENTRY_FILE', YII_APP_BASE_PATH . '/frontend/web/index-test.php');
|
||||
|
||||
require_once(YII_APP_BASE_PATH . '/vendor/autoload.php');
|
||||
@@ -17,6 +17,7 @@ require_once(YII_APP_BASE_PATH . '/frontend/config/bootstrap.php');
|
||||
// the entry script file path for functional and acceptance tests
|
||||
$_SERVER['SCRIPT_FILENAME'] = FRONTEND_ENTRY_FILE;
|
||||
$_SERVER['SCRIPT_NAME'] = FRONTEND_ENTRY_URL;
|
||||
$_SERVER['SERVER_NAME'] = 'localhost';
|
||||
$_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';
|
||||
|
||||
Yii::setAlias('@tests', dirname(dirname(__DIR__)));
|
||||
|
||||
@@ -20,8 +20,9 @@ modules:
|
||||
# - WebDriver
|
||||
config:
|
||||
PhpBrowser:
|
||||
url: 'http://localhost:8080'
|
||||
# PLEASE ADJUST IT TO THE ACTUAL ENTRY POINT WITHOUT PATH INFO
|
||||
url: http://localhost:8080
|
||||
# WebDriver:
|
||||
# url: 'http://localhost'
|
||||
# url: http://localhost:8080
|
||||
# browser: firefox
|
||||
# restart: true
|
||||
|
||||
@@ -12,6 +12,6 @@ settings:
|
||||
memory_limit: 1024M
|
||||
log: true
|
||||
config:
|
||||
# the entry script URL (without host info) for functional and acceptance tests
|
||||
# the entry script URL (with host info) for functional and acceptance tests
|
||||
# PLEASE ADJUST IT TO THE ACTUAL ENTRY SCRIPT URL
|
||||
test_entry_url: /frontend/web/index-test.php
|
||||
test_entry_url: http://localhost:8080/frontend/web/index-test.php
|
||||
|
||||
@@ -11,6 +11,6 @@ settings:
|
||||
log: true
|
||||
colors: true
|
||||
config:
|
||||
# the entry script URL (without host info) for functional and acceptance tests
|
||||
# the entry script URL (with host info) for functional and acceptance tests
|
||||
# PLEASE ADJUST IT TO THE ACTUAL ENTRY SCRIPT URL
|
||||
test_entry_url: /index-test.php
|
||||
test_entry_url: http://localhost:8080/index-test.php
|
||||
@@ -2,7 +2,7 @@
|
||||
defined('YII_DEBUG') or define('YII_DEBUG', true);
|
||||
defined('YII_ENV') or define('YII_ENV', 'test');
|
||||
|
||||
defined('YII_TEST_ENTRY_URL') or define('YII_TEST_ENTRY_URL', \Codeception\Configuration::config()['config']['test_entry_url']);
|
||||
defined('YII_TEST_ENTRY_URL') or define('YII_TEST_ENTRY_URL', parse_url(\Codeception\Configuration::config()['config']['test_entry_url'], PHP_URL_PATH));
|
||||
defined('YII_TEST_ENTRY_FILE') or define('YII_TEST_ENTRY_FILE', dirname(dirname(__DIR__)) . '/web/index-test.php');
|
||||
|
||||
require_once(__DIR__ . '/../../vendor/autoload.php');
|
||||
@@ -10,6 +10,7 @@ require_once(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php');
|
||||
|
||||
$_SERVER['SCRIPT_FILENAME'] = YII_TEST_ENTRY_FILE;
|
||||
$_SERVER['SCRIPT_NAME'] = YII_TEST_ENTRY_URL;
|
||||
$_SERVER['SERVER_NAME'] = 'localhost';
|
||||
$_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';
|
||||
|
||||
Yii::setAlias('@tests', dirname(__DIR__));
|
||||
|
||||
@@ -19,8 +19,9 @@ modules:
|
||||
# - WebDriver
|
||||
config:
|
||||
PhpBrowser:
|
||||
url: 'http://localhost:8080'
|
||||
# PLEASE ADJUST IT TO THE ACTUAL ENTRY POINT WITHOUT PATH INFO
|
||||
url: http://localhost:8080
|
||||
# WebDriver:
|
||||
# url: 'http://localhost'
|
||||
# url: http://localhost:8080
|
||||
# browser: firefox
|
||||
# restart: true
|
||||
|
||||
Reference in New Issue
Block a user