_bootstrap.php 1.1 KB

1234567891011121314151617181920212223
  1. <?php
  2. defined('YII_DEBUG') or define('YII_DEBUG', true);
  3. defined('YII_ENV') or define('YII_ENV', 'test');
  4. defined('YII_TEST_ENTRY_URL') or define('YII_TEST_ENTRY_URL', parse_url(\Codeception\Configuration::config()['config']['test_entry_url'], PHP_URL_PATH));
  5. defined('YII_TEST_ENTRY_FILE') or define('YII_TEST_ENTRY_FILE', dirname(dirname(__DIR__)) . '/web/index-test.php');
  6. require_once(__DIR__ . '/../../vendor/autoload.php');
  7. require_once(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php');
  8. $_SERVER['SCRIPT_FILENAME'] = YII_TEST_ENTRY_FILE;
  9. $_SERVER['SCRIPT_NAME'] = YII_TEST_ENTRY_URL;
  10. $_SERVER['SERVER_NAME'] = parse_url(\Codeception\Configuration::config()['config']['test_entry_url'], PHP_URL_HOST);
  11. $_SERVER['SERVER_PORT'] = parse_url(\Codeception\Configuration::config()['config']['test_entry_url'], PHP_URL_PORT) ?: '80';
  12. Yii::setAlias('@tests', dirname(__DIR__));
  13. /**
  14. * this configure codeception specify to not deep clone objects properties
  15. * it can be configure localy in your tests
  16. * @see https://github.com/Codeception/Specify/tree/master/docs
  17. */
  18. \Codeception\Specify\Config::setDeepClone(false);