mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 12:54:52 +08:00
Fix PHPUnit test, remove unneeded test (function is dynamic)
This commit is contained in:
parent
83dae09208
commit
df76ecb60f
@ -23,6 +23,10 @@ final class GlobalEnvManagerTest extends TestCase
|
|||||||
'SPC_TARGET' => getenv('SPC_TARGET'),
|
'SPC_TARGET' => getenv('SPC_TARGET'),
|
||||||
'SPC_LIBC' => getenv('SPC_LIBC'),
|
'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
|
protected function tearDown(): void
|
||||||
@ -35,6 +39,10 @@ final class GlobalEnvManagerTest extends TestCase
|
|||||||
putenv("{$key}={$value}");
|
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
|
public function testGetInitializedEnv(): void
|
||||||
|
|||||||
@ -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
|
* @dataProvider libcProvider
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user