Skip to content

Commit 398622a

Browse files
committed
Tests - always initialize the container
1 parent 9361b23 commit 398622a

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

src/Testing/PHPStanTestCase.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ public static function getContainer(): Container
9696
return self::$containers[$cacheKey];
9797
}
9898

99+
public static function setUpBeforeClass(): void
100+
{
101+
self::getContainer();
102+
}
103+
99104
/**
100105
* @return string[]
101106
*/

tests/PHPStan/DependencyInjection/InvalidIgnoredErrorExceptionTest.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
class InvalidIgnoredErrorExceptionTest extends PHPStanTestCase
99
{
1010

11-
private static string $configFile;
11+
private static ?string $configFile = null;
1212

1313
/**
1414
* @return iterable<array{string, string}>
@@ -55,10 +55,14 @@ public function testValidateIgnoreErrors(string $file, string $expectedMessage):
5555

5656
public static function getAdditionalConfigFiles(): array
5757
{
58-
return [
58+
$files = [
5959
__DIR__ . '/../../../conf/bleedingEdge.neon',
60-
self::$configFile,
6160
];
61+
if (self::$configFile !== null) {
62+
$files[] = self::$configFile;
63+
}
64+
65+
return $files;
6266
}
6367

6468
}

tests/bootstrap.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php declare(strict_types = 1);
22

3-
use PHPStan\Testing\PHPStanTestCase;
4-
53
error_reporting(E_ALL);
64

75
require_once __DIR__ . '/../vendor/autoload.php';
@@ -21,5 +19,3 @@ public function doFoo($i)
2119
}
2220
2321
}');
24-
25-
PHPStanTestCase::getContainer();

0 commit comments

Comments
 (0)