From df76ecb60ffbd9f5db91294520a726e0d683deeb Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Tue, 29 Jul 2025 12:14:31 +0800 Subject: [PATCH] Fix PHPUnit test, remove unneeded test (function is dynamic) --- tests/SPC/util/GlobalEnvManagerTest.php | 8 ++++++++ tests/SPC/util/SPCTargetTest.php | 11 ----------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/tests/SPC/util/GlobalEnvManagerTest.php b/tests/SPC/util/GlobalEnvManagerTest.php index 28d60d34..1caeaa19 100644 --- a/tests/SPC/util/GlobalEnvManagerTest.php +++ b/tests/SPC/util/GlobalEnvManagerTest.php @@ -23,6 +23,10 @@ final class GlobalEnvManagerTest extends TestCase 'SPC_TARGET' => getenv('SPC_TARGET'), 'SPC_LIBC' => getenv('SPC_LIBC'), ]; + // Temporarily set private GlobalEnvManager::$initialized to false (use reflection) + $reflection = new \ReflectionClass(GlobalEnvManager::class); + $property = $reflection->getProperty('initialized'); + $property->setValue(null, false); } protected function tearDown(): void @@ -35,6 +39,10 @@ final class GlobalEnvManagerTest extends TestCase putenv("{$key}={$value}"); } } + // Temporarily set private GlobalEnvManager::$initialized to false (use reflection) + $reflection = new \ReflectionClass(GlobalEnvManager::class); + $property = $reflection->getProperty('initialized'); + $property->setValue(null, true); } public function testGetInitializedEnv(): void diff --git a/tests/SPC/util/SPCTargetTest.php b/tests/SPC/util/SPCTargetTest.php index 05d95e08..665b4045 100644 --- a/tests/SPC/util/SPCTargetTest.php +++ b/tests/SPC/util/SPCTargetTest.php @@ -34,17 +34,6 @@ final class SPCTargetTest extends TestBase } } - /** - * @dataProvider libcProvider - */ - public function testIsStatic(string $libc, bool $expected): void - { - putenv("SPC_LIBC={$libc}"); - - $result = SPCTarget::isStatic(); - $this->assertEquals($expected, $result); - } - /** * @dataProvider libcProvider */