diff --git a/tests/codeception.yml b/tests/codeception.yml index ba02c81..0a45a0c 100644 --- a/tests/codeception.yml +++ b/tests/codeception.yml @@ -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 \ No newline at end of file + test_entry_url: http://localhost:8080/index-test.php \ No newline at end of file diff --git a/tests/codeception/_bootstrap.php b/tests/codeception/_bootstrap.php index 9855939..755029e 100644 --- a/tests/codeception/_bootstrap.php +++ b/tests/codeception/_bootstrap.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__)); diff --git a/tests/codeception/acceptance.suite.yml b/tests/codeception/acceptance.suite.yml index a045043..1781b00 100644 --- a/tests/codeception/acceptance.suite.yml +++ b/tests/codeception/acceptance.suite.yml @@ -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