index-test.php 618 B

123456789101112131415161718192021222324
  1. <?php
  2. if (!in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1'])) {
  3. die('You are not allowed to access this file.');
  4. }
  5. defined('YII_DEBUG') or define('YII_DEBUG', true);
  6. defined('YII_ENV') or define('YII_ENV', 'test');
  7. require_once(__DIR__ . '/../vendor/autoload.php');
  8. require_once(__DIR__ . '/../vendor/yiisoft/yii2/yii/Yii.php');
  9. $config = require(__DIR__ . '/../config/web-test.php');
  10. if (isset($this)) {
  11. // run in functional tests
  12. $config['class'] = 'yii\web\Application';
  13. return $config;
  14. } else {
  15. // run in acceptance tests
  16. $application = new yii\web\Application($config);
  17. $application->run();
  18. }