Passed
Pull Request — master (#42)
by Dmitriy
26:25 queued 11:25
created

RebuildHook::executeBeforeFirstTest()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 8
c 2
b 0
f 0
dl 0
loc 13
rs 10
cc 2
nc 2
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Composer\Config\Tests\Integration;
6
7
use PHPUnit\Runner\BeforeFirstTestHook;
8
use Yiisoft\Composer\Config\Builder;
9
use Yiisoft\Composer\Config\Util\PathHelper;
10
11
final class RebuildHook implements BeforeFirstTestHook
12
{
13
    public function executeBeforeFirstTest(): void
14
    {
15
        if (!(bool) ($_SERVER['REBUILD'] ?? false)) {
16
            return;
17
        }
18
        $directory = PathHelper::realpath(__DIR__) . '/Environment';
19
20
        echo "Changing CWD to {$directory}" . PHP_EOL;
21
        chdir($directory);
22
23
        require_once 'vendor/autoload.php';
24
        echo 'Rebuild configs...' . PHP_EOL;
25
        Builder::rebuild();
26
    }
27
}
28