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