Fixes #6103: Improved codeception config in app templates to ease testing of advanced app on multiple hosts

This commit is contained in:
Anton Andersen 2014-11-19 14:37:13 +03:00 committed by Alexander Makarov
parent c10a6b46be
commit 6b4ad97e43
3 changed files with 8 additions and 6 deletions

View File

@ -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

View File

@ -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__));

View File

@ -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