mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
fix tests
This commit is contained in:
parent
72abd63b69
commit
81f359dbcf
@ -17,6 +17,8 @@ use SPC\toolchain\ToolchainManager;
|
||||
*/
|
||||
class SPCTarget
|
||||
{
|
||||
const array LIBC_LIST = ['musl', 'glibc'];
|
||||
|
||||
/**
|
||||
* Returns whether we link the C runtime in statically.
|
||||
*/
|
||||
@ -107,7 +109,6 @@ class SPCTarget
|
||||
* Currently, we only support native building.
|
||||
*
|
||||
* @return 'BSD'|'Darwin'|'Linux'|'Windows'
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
public static function getTargetOS(): string
|
||||
{
|
||||
|
||||
@ -85,19 +85,6 @@ final class SPCTargetTest extends TestBase
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider invalidTargetProvider
|
||||
*/
|
||||
public function testGetTargetOSWithInvalidTarget(string $target): void
|
||||
{
|
||||
putenv("SPC_TARGET={$target}");
|
||||
|
||||
$this->expectException(WrongUsageException::class);
|
||||
$this->expectExceptionMessage('Cannot parse target.');
|
||||
|
||||
SPCTarget::getTargetOS();
|
||||
}
|
||||
|
||||
public function testLibcListConstant(): void
|
||||
{
|
||||
$this->assertIsArray(SPCTarget::LIBC_LIST);
|
||||
@ -117,22 +104,13 @@ final class SPCTargetTest extends TestBase
|
||||
public function targetOSProvider(): array
|
||||
{
|
||||
return [
|
||||
'linux-target' => ['linux-x86_64', 'Linux'],
|
||||
'macos-target' => ['macos-x86_64', 'Darwin'],
|
||||
'windows-target' => ['windows-x86_64', 'Windows'],
|
||||
'linux-target' => ['native-linux', 'Linux'],
|
||||
'macos-target' => ['native-macos', 'Darwin'],
|
||||
'windows-target' => ['native-windows', 'Windows'],
|
||||
'empty-target' => ['', PHP_OS_FAMILY],
|
||||
];
|
||||
}
|
||||
|
||||
public function invalidTargetProvider(): array
|
||||
{
|
||||
return [
|
||||
'invalid-target' => ['invalid-target'],
|
||||
'unknown-target' => ['unknown-target'],
|
||||
'mixed-target' => ['mixed-target'],
|
||||
];
|
||||
}
|
||||
|
||||
private function assertIsStringOrNull($value): void
|
||||
{
|
||||
$this->assertTrue(is_string($value) || is_null($value), 'Value must be string or null');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user