Add more PHPUnit tests

This commit is contained in:
crazywhalecc
2025-04-18 14:01:03 +08:00
committed by Jerry Ma
parent 5e67133495
commit b06db1f920
6 changed files with 199 additions and 0 deletions

View File

@@ -33,6 +33,10 @@ final class LicenseDumperTest extends TestCase
public function testDumpWithSingleLicense(): void
{
$bak = [
'source' => Config::$source,
'lib' => Config::$lib,
];
Config::$lib = [
'lib-base' => ['type' => 'root'],
'php' => ['type' => 'root'],
@@ -54,10 +58,17 @@ final class LicenseDumperTest extends TestCase
$dumper->dump(self::DIRECTORY);
$this->assertFileExists(self::DIRECTORY . '/lib_fake_lib_0.txt');
// restore
Config::$source = $bak['source'];
Config::$lib = $bak['lib'];
}
public function testDumpWithMultipleLicenses(): void
{
$bak = [
'source' => Config::$source,
'lib' => Config::$lib,
];
Config::$lib = [
'lib-base' => ['type' => 'root'],
'php' => ['type' => 'root'],
@@ -91,5 +102,9 @@ final class LicenseDumperTest extends TestCase
$this->assertFileExists(self::DIRECTORY . '/lib_fake_lib_0.txt');
$this->assertFileExists(self::DIRECTORY . '/lib_fake_lib_1.txt');
$this->assertFileExists(self::DIRECTORY . '/lib_fake_lib_2.txt');
// restore
Config::$source = $bak['source'];
Config::$lib = $bak['lib'];
}
}