mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-19 13:08:40 +00:00
fix tests
This commit is contained in:
parent
58c49080c8
commit
67ca803026
|
|
@ -34,7 +34,7 @@ class TarGz implements ArchiveInterface
|
|||
public static function pack($source, string $destination, bool $overwrite = false) : bool
|
||||
{
|
||||
$destination = \str_replace('\\', '/', $destination);
|
||||
if (!$overwrite && \file_exists($destination) || !\file_exists($source)) {
|
||||
if (!$overwrite && \file_exists($destination)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -43,7 +43,10 @@ class TarGz implements ArchiveInterface
|
|||
}
|
||||
|
||||
$pack = Gz::pack($destination . '.tmp', $destination, $overwrite);
|
||||
\unlink($destination . '.tmp');
|
||||
|
||||
if ($pack) {
|
||||
\unlink($destination . '.tmp');
|
||||
}
|
||||
|
||||
return $pack;
|
||||
}
|
||||
|
|
@ -54,7 +57,7 @@ class TarGz implements ArchiveInterface
|
|||
public static function unpack(string $source, string $destination) : bool
|
||||
{
|
||||
$destination = \str_replace('\\', '/', $destination);
|
||||
if (\file_exists($destination) || !\file_exists($source)) {
|
||||
if (!\file_exists($destination) || !\file_exists($source)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -348,6 +348,8 @@ class FileTest extends \PHPUnit\Framework\TestCase
|
|||
public function testStaticCreatedAt() : void
|
||||
{
|
||||
$testFile = __DIR__ . '/test.txt';
|
||||
File::delete(self::$con, $testFile);
|
||||
|
||||
self::assertTrue(File::create(self::$con, $testFile));
|
||||
|
||||
$now = new \DateTime('now');
|
||||
|
|
@ -364,6 +366,8 @@ class FileTest extends \PHPUnit\Framework\TestCase
|
|||
public function testStaticChangedAt() : void
|
||||
{
|
||||
$testFile = __DIR__ . '/test.txt';
|
||||
File::delete(self::$con, $testFile);
|
||||
|
||||
self::assertTrue(File::create(self::$con, $testFile));
|
||||
|
||||
$now = new \DateTime('now');
|
||||
|
|
@ -406,6 +410,8 @@ class FileTest extends \PHPUnit\Framework\TestCase
|
|||
public function testStaticSize() : void
|
||||
{
|
||||
$testFile = __DIR__ . '/test.txt';
|
||||
File::delete(self::$con, $testFile);
|
||||
|
||||
File::put(self::$con, $testFile, 'test', ContentPutMode::CREATE);
|
||||
|
||||
self::assertGreaterThan(0, File::size(self::$con, $testFile));
|
||||
|
|
@ -421,6 +427,8 @@ class FileTest extends \PHPUnit\Framework\TestCase
|
|||
public function testStaticPermission() : void
|
||||
{
|
||||
$testFile = __DIR__ . '/test.txt';
|
||||
File::delete(self::$con, $testFile);
|
||||
|
||||
File::put(self::$con, $testFile, 'test', ContentPutMode::CREATE);
|
||||
|
||||
self::assertGreaterThan(0, File::permission(self::$con, $testFile));
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user