From cbdab39e44f5e02f1627a3097385fa48c5d989cd Mon Sep 17 00:00:00 2001 From: Milos Stojanovic Date: Mon, 11 May 2020 13:34:39 +0000 Subject: [PATCH] fix/test: create empty zip archive is futile --- backend/Services/Tmpfs/Adapters/Tmpfs.php | 8 +------- tests/backend/Unit/ArchiverTest.php | 4 ++-- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/backend/Services/Tmpfs/Adapters/Tmpfs.php b/backend/Services/Tmpfs/Adapters/Tmpfs.php index 671cf5c..f5c9a3a 100644 --- a/backend/Services/Tmpfs/Adapters/Tmpfs.php +++ b/backend/Services/Tmpfs/Adapters/Tmpfs.php @@ -47,13 +47,7 @@ class Tmpfs implements Service, TmpfsInterface { $filename = $this->sanitizeFilename($filename); - $realPath = $this->getPath().$filename; - - if (! is_file($realPath)) { - touch($realPath); - } - - return $realPath; + return $this->getPath().$filename; } public function read(string $filename): string diff --git a/tests/backend/Unit/ArchiverTest.php b/tests/backend/Unit/ArchiverTest.php index 7a643ad..730d9fe 100644 --- a/tests/backend/Unit/ArchiverTest.php +++ b/tests/backend/Unit/ArchiverTest.php @@ -38,7 +38,7 @@ class ArchiverTest extends TestCase parent::setUp(); } - public function testCreatingArchive() + public function testCreatingEmptyArchive() { $storage = new Filesystem(); $storage->init([ @@ -51,7 +51,7 @@ class ArchiverTest extends TestCase $uniqid = $this->archiver->createArchive($storage); $this->assertNotNull($uniqid); - $this->assertFileExists(TEST_TMP_PATH.$uniqid); + $this->assertFileNotExists(TEST_TMP_PATH.$uniqid); } public function testAddingDirectoryWithFilesAndSubdir()