Total Complexity | 4 |
Total Lines | 49 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php declare(strict_types = 1); |
||
7 | trait PhpWebServer |
||
8 | { |
||
9 | /** @var string */ |
||
10 | private static $webserverDocroot = 'public'; |
||
11 | |||
12 | /** @var string */ |
||
13 | private static $webserverRouter = 'public/app.php'; |
||
14 | |||
15 | /** @var Process */ |
||
16 | private static $webserverProcess; |
||
17 | |||
18 | /** |
||
19 | * @beforeClass |
||
20 | */ |
||
21 | public static function startWebserver(): void |
||
37 | } |
||
38 | |||
39 | private static function verifyProcessRunning(Process $process): void |
||
40 | { |
||
41 | if (!$process->isRunning()) { |
||
42 | throw new \RuntimeException(sprintf( |
||
43 | 'Failed to start "%s" in background: %s', |
||
44 | $process->getCommandLine(), |
||
45 | $process->getErrorOutput() |
||
46 | )); |
||
47 | } |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * @afterClass |
||
52 | */ |
||
53 | public static function stopWebserver(): void |
||
56 | } |
||
57 | } |
||
58 |