diff --git a/tests/Cache/CacheTest.php b/tests/Cache/CacheTest.php index c696aef96dd..cb04a6d9e62 100644 --- a/tests/Cache/CacheTest.php +++ b/tests/Cache/CacheTest.php @@ -26,6 +26,15 @@ class CacheTest extends TestCase { + public static function setUpBeforeClass(): void + { + parent::setUpBeforeClass(); + + // hack to isolate Psalm from PHPUnit cli arguments + global $argv; + $argv = []; + } + public function setUp(): void { parent::setUp(); diff --git a/tests/Config/ConfigFileTest.php b/tests/Config/ConfigFileTest.php index a198a41c87d..746fc62d27e 100644 --- a/tests/Config/ConfigFileTest.php +++ b/tests/Config/ConfigFileTest.php @@ -23,6 +23,15 @@ class ConfigFileTest extends TestCase { private string $file_path; + public static function setUpBeforeClass(): void + { + parent::setUpBeforeClass(); + + // hack to isolate Psalm from PHPUnit cli arguments + global $argv; + $argv = []; + } + public function setUp(): void { RuntimeCaches::clearAll(); diff --git a/tests/Config/ConfigTest.php b/tests/Config/ConfigTest.php index dd6a3fa6b80..605140a8bbf 100644 --- a/tests/Config/ConfigTest.php +++ b/tests/Config/ConfigTest.php @@ -56,6 +56,10 @@ class ConfigTest extends TestCase public static function setUpBeforeClass(): void { + // hack to isolate Psalm from PHPUnit cli arguments + global $argv; + $argv = []; + self::$config = new TestConfig(); if (!defined('PSALM_VERSION')) { @@ -1334,10 +1338,6 @@ function handleThrow(I $e) : void { public function testModularConfig(): void { - // hack to isolate Psalm from PHPUnit arguments - global $argv; - $argv = []; - $root = __DIR__ . '/../fixtures/ModularConfig'; $config = Config::loadFromXMLFile($root . '/psalm.xml', $root); $this->assertEquals( diff --git a/tests/ForbiddenCodeTest.php b/tests/ForbiddenCodeTest.php index a841f65fcf3..bae5147beb5 100644 --- a/tests/ForbiddenCodeTest.php +++ b/tests/ForbiddenCodeTest.php @@ -19,6 +19,15 @@ class ForbiddenCodeTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; + public static function setUpBeforeClass(): void + { + parent::setUpBeforeClass(); + + // hack to isolate Psalm from PHPUnit cli arguments + global $argv; + $argv = []; + } + public function providerInvalidCodeParse(): iterable { return [ diff --git a/tests/StubTest.php b/tests/StubTest.php index 1e297daf976..38b8d364474 100644 --- a/tests/StubTest.php +++ b/tests/StubTest.php @@ -35,6 +35,10 @@ class StubTest extends TestCase public static function setUpBeforeClass(): void { + // hack to isolate Psalm from PHPUnit cli arguments + global $argv; + $argv = []; + self::$config = new TestConfig(); if (!defined('PSALM_VERSION')) { diff --git a/tests/VariadicTest.php b/tests/VariadicTest.php index e77b0a142bb..8e543612b00 100644 --- a/tests/VariadicTest.php +++ b/tests/VariadicTest.php @@ -19,6 +19,15 @@ class VariadicTest extends TestCase { use ValidCodeAnalysisTestTrait; + public static function setUpBeforeClass(): void + { + parent::setUpBeforeClass(); + + // hack to isolate Psalm from PHPUnit cli arguments + global $argv; + $argv = []; + } + public function testVariadicArrayBadParam(): void { $this->expectExceptionMessage('InvalidScalarArgument');