Commit 6c88467a by Anton Andersen Committed by Alexander Makarov

Fixes #6103: Improved codeception config in app templates to ease testing of…

Fixes #6103: Improved codeception config in app templates to ease testing of advanced app on multiple hosts
parent af50f5a2
...@@ -4,7 +4,7 @@ defined('YII_ENV') or define('YII_ENV', 'test'); ...@@ -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_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'); 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'); require_once(YII_APP_BASE_PATH . '/vendor/autoload.php');
...@@ -17,6 +17,7 @@ require_once(YII_APP_BASE_PATH . '/backend/config/bootstrap.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 // the entry script file path for functional and acceptance tests
$_SERVER['SCRIPT_FILENAME'] = YII_TEST_BACKEND_ENTRY_FILE; $_SERVER['SCRIPT_FILENAME'] = YII_TEST_BACKEND_ENTRY_FILE;
$_SERVER['SCRIPT_NAME'] = YII_BACKEND_TEST_ENTRY_URL; $_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__))); Yii::setAlias('@tests', dirname(dirname(__DIR__)));
...@@ -20,8 +20,9 @@ modules: ...@@ -20,8 +20,9 @@ modules:
# - WebDriver # - WebDriver
config: config:
PhpBrowser: PhpBrowser:
url: 'http://localhost:8080' # PLEASE ADJUST IT TO THE ACTUAL ENTRY POINT WITHOUT PATH INFO
url: http://localhost:8080
# WebDriver: # WebDriver:
# url: 'http://localhost' # url: http://localhost:8080
# browser: firefox # browser: firefox
# restart: true # restart: true
...@@ -12,6 +12,6 @@ settings: ...@@ -12,6 +12,6 @@ settings:
memory_limit: 1024M memory_limit: 1024M
log: true log: true
config: 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 # 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'); ...@@ -10,5 +10,6 @@ require_once(YII_APP_BASE_PATH . '/common/config/bootstrap.php');
// set correct script paths // set correct script paths
$_SERVER['SERVER_NAME'] = 'localhost'; $_SERVER['SERVER_NAME'] = 'localhost';
$_SERVER['SERVER_PORT'] = '80';
Yii::setAlias('@tests', dirname(dirname(__DIR__))); Yii::setAlias('@tests', dirname(dirname(__DIR__)));
...@@ -11,5 +11,6 @@ require_once(YII_APP_BASE_PATH . '/console/config/bootstrap.php'); ...@@ -11,5 +11,6 @@ require_once(YII_APP_BASE_PATH . '/console/config/bootstrap.php');
// set correct script paths // set correct script paths
$_SERVER['SERVER_NAME'] = 'localhost'; $_SERVER['SERVER_NAME'] = 'localhost';
$_SERVER['SERVER_PORT'] = '80';
Yii::setAlias('@tests', dirname(dirname(__DIR__))); Yii::setAlias('@tests', dirname(dirname(__DIR__)));
...@@ -4,7 +4,7 @@ defined('YII_ENV') or define('YII_ENV', 'test'); ...@@ -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_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'); 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'); require_once(YII_APP_BASE_PATH . '/vendor/autoload.php');
...@@ -17,6 +17,7 @@ require_once(YII_APP_BASE_PATH . '/frontend/config/bootstrap.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 // the entry script file path for functional and acceptance tests
$_SERVER['SCRIPT_FILENAME'] = FRONTEND_ENTRY_FILE; $_SERVER['SCRIPT_FILENAME'] = FRONTEND_ENTRY_FILE;
$_SERVER['SCRIPT_NAME'] = FRONTEND_ENTRY_URL; $_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__))); Yii::setAlias('@tests', dirname(dirname(__DIR__)));
...@@ -20,8 +20,9 @@ modules: ...@@ -20,8 +20,9 @@ modules:
# - WebDriver # - WebDriver
config: config:
PhpBrowser: PhpBrowser:
url: 'http://localhost:8080' # PLEASE ADJUST IT TO THE ACTUAL ENTRY POINT WITHOUT PATH INFO
url: http://localhost:8080
# WebDriver: # WebDriver:
# url: 'http://localhost' # url: http://localhost:8080
# browser: firefox # browser: firefox
# restart: true # restart: true
...@@ -12,6 +12,6 @@ settings: ...@@ -12,6 +12,6 @@ settings:
memory_limit: 1024M memory_limit: 1024M
log: true log: true
config: 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 # 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: ...@@ -11,6 +11,6 @@ settings:
log: true log: true
colors: true colors: true
config: 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 # PLEASE ADJUST IT TO THE ACTUAL ENTRY SCRIPT URL
test_entry_url: /index-test.php test_entry_url: http://localhost:8080/index-test.php
\ No newline at end of file \ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
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('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'); defined('YII_TEST_ENTRY_FILE') or define('YII_TEST_ENTRY_FILE', dirname(dirname(__DIR__)) . '/web/index-test.php');
require_once(__DIR__ . '/../../vendor/autoload.php'); require_once(__DIR__ . '/../../vendor/autoload.php');
...@@ -10,6 +10,7 @@ require_once(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php'); ...@@ -10,6 +10,7 @@ require_once(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php');
$_SERVER['SCRIPT_FILENAME'] = YII_TEST_ENTRY_FILE; $_SERVER['SCRIPT_FILENAME'] = YII_TEST_ENTRY_FILE;
$_SERVER['SCRIPT_NAME'] = YII_TEST_ENTRY_URL; $_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__)); Yii::setAlias('@tests', dirname(__DIR__));
...@@ -19,8 +19,9 @@ modules: ...@@ -19,8 +19,9 @@ modules:
# - WebDriver # - WebDriver
config: config:
PhpBrowser: PhpBrowser:
url: 'http://localhost:8080' # PLEASE ADJUST IT TO THE ACTUAL ENTRY POINT WITHOUT PATH INFO
url: http://localhost:8080
# WebDriver: # WebDriver:
# url: 'http://localhost' # url: http://localhost:8080
# browser: firefox # browser: firefox
# restart: true # restart: true
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