diff --git a/System/File/Local/Directory.php b/System/File/Local/Directory.php index 2ecb06c69..3884037c4 100644 --- a/System/File/Local/Directory.php +++ b/System/File/Local/Directory.php @@ -227,6 +227,10 @@ final class Directory extends FileAbstract implements DirectoryInterface */ public static function delete(string $path) : bool { + if (empty($path)) { + return false; + } + $files = \scandir($path); if ($files === false) { diff --git a/tests/Module/PackageManagerTest.php b/tests/Module/PackageManagerTest.php index d8162c52f..1315f13de 100644 --- a/tests/Module/PackageManagerTest.php +++ b/tests/Module/PackageManagerTest.php @@ -34,6 +34,10 @@ class PackageManagerTest extends \PHPUnit\Framework\TestCase \array_map('unlink', \glob(__DIR__ . '/testPackageExtracted/*')); } + if (file_exists(__DIR__ . '/public.key')) { + unlink(__DIR__ . '/public.key'); + } + // create keys $alice_sign_kp = \sodium_crypto_sign_keypair(); @@ -93,6 +97,7 @@ class PackageManagerTest extends \PHPUnit\Framework\TestCase \file_get_contents(__DIR__ . '/public.key') ); + $package->extract(__DIR__ . '/testPackageExtracted'); $package->cleanup(); self::assertFalse(file_exists(__DIR__ . '/testPackage.zip')); @@ -107,6 +112,13 @@ class PackageManagerTest extends \PHPUnit\Framework\TestCase if (file_exists(__DIR__ . '/testPackageExtracted')) { \array_map('unlink', \glob(__DIR__ . '/testPackageExtracted/*')); + \rmdir(__DIR__ . '/testPackageExtracted'); } + + if (file_exists(__DIR__ . '/public.key')) { + unlink(__DIR__ . '/public.key'); + } + + file_put_contents(__DIR__ . '/testPackage/package.cert', ''); } } diff --git a/tests/Module/testPackage/package.cert b/tests/Module/testPackage/package.cert index 1f27d89ea..e69de29bb 100644 --- a/tests/Module/testPackage/package.cert +++ b/tests/Module/testPackage/package.cert @@ -1 +0,0 @@ -9  >AM=1[Q5 b3'{z0t=uOz扛h \ No newline at end of file