From 3e78a20871ae8ff5762677932d9117d8ab34810e Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Sat, 12 Oct 2024 21:51:34 +0200 Subject: [PATCH] Fix the tests broken when running with Paratest The break was introduced in #10483 --- tests/Config/ConfigTest.php | 4 ++++ tests/Config/PluginTest.php | 4 ++++ tests/ProjectCheckerTest.php | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/tests/Config/ConfigTest.php b/tests/Config/ConfigTest.php index d0aa56b1cc0..dd6a3fa6b80 100644 --- a/tests/Config/ConfigTest.php +++ b/tests/Config/ConfigTest.php @@ -1334,6 +1334,10 @@ 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/Config/PluginTest.php b/tests/Config/PluginTest.php index 61747f6b35f..9c3297633f6 100644 --- a/tests/Config/PluginTest.php +++ b/tests/Config/PluginTest.php @@ -44,6 +44,10 @@ class PluginTest 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/ProjectCheckerTest.php b/tests/ProjectCheckerTest.php index 3e7bf7af31c..da8f75fe0c2 100644 --- a/tests/ProjectCheckerTest.php +++ b/tests/ProjectCheckerTest.php @@ -41,6 +41,10 @@ class ProjectCheckerTest extends TestCase public static function setUpBeforeClass(): void { + // hack to stop Psalm seeing the phpunit arguments + global $argv; + $argv = []; + self::$config = new TestConfig(); if (!defined('PSALM_VERSION')) {