Skip to content

Commit

Permalink
Clean code bootstrap.php.
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw committed Nov 20, 2023
1 parent cbf0188 commit a3718dd
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions tests/Support/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@

declare(strict_types=1);

error_reporting(-1);

$rootDir = dirname(__DIR__, 2);
$vendorDir = $rootDir . '/' . 'vendor';

defined('YII_DEBUG') || define('YII_DEBUG', false);
define('YII_ENV', 'test');

$_SERVER['SCRIPT_NAME'] = '/' . __DIR__;
$_SERVER['SCRIPT_FILENAME'] = __FILE__;
$root = dirname(__DIR__, 2);

$autoload = $root . '/vendor/autoload.php';
$yii2 = $root . '/vendor/yiisoft/yii2/Yii.php';

if (!is_file($autoload)) {
die('You need to set up the project dependencies using Composer');
}

if (!file_exists($vendorDir . '/autoload.php')) {
die('Please run composer install');
if (!is_file($yii2)) {
die('You need to set up yii2 using composer');
}

require_once $vendorDir . '/autoload.php';
require_once $vendorDir . '/yiisoft/yii2/Yii.php';
require_once $autoload;
require_once $yii2;

0 comments on commit a3718dd

Please sign in to comment.