From 21bf9fd0e231ee18cf4d9faa1b8227846df780f5 Mon Sep 17 00:00:00 2001 From: Benjamin Perche Date: Thu, 3 Jul 2014 13:38:40 +0200 Subject: [PATCH] =?UTF-8?q?Complete=20zip=20tests=20=09modifi=C3=A9:=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20core/lib/Thelia/Core/FileFormat/Archive/Ar?= =?UTF-8?q?chiveBuilder/TarArchiveBuilder.php=20=09modifi=C3=A9:=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20core/lib/Thelia/Core/FileFormat/Archive/Archi?= =?UTF-8?q?veBuilderInterface.php=20=09modifi=C3=A9:=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20core/lib/Thelia/Tests/FileFormat/Archive/ArchiveBuilder/T?= =?UTF-8?q?arArchiveBuilderTest.php=20=09modifi=C3=A9:=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20core/lib/Thelia/Tests/FileFormat/Archive/ArchiveBuilde?= =?UTF-8?q?r/ZipArchiveBuilderTest.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Archive/ArchiveBuilder/TarArchiveBuilder.php | 4 ++-- .../FileFormat/Archive/ArchiveBuilderInterface.php | 2 +- .../ArchiveBuilder/TarArchiveBuilderTest.php | 7 +++++++ .../ArchiveBuilder/ZipArchiveBuilderTest.php | 13 +++++++++++++ 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/core/lib/Thelia/Core/FileFormat/Archive/ArchiveBuilder/TarArchiveBuilder.php b/core/lib/Thelia/Core/FileFormat/Archive/ArchiveBuilder/TarArchiveBuilder.php index c5b019f46..d34824cfe 100644 --- a/core/lib/Thelia/Core/FileFormat/Archive/ArchiveBuilder/TarArchiveBuilder.php +++ b/core/lib/Thelia/Core/FileFormat/Archive/ArchiveBuilder/TarArchiveBuilder.php @@ -101,7 +101,7 @@ class TarArchiveBuilder extends AbstractArchiveBuilder * Download the file if it is online * If it's local check if the file exists and if it is redable */ - $fileDownloadCache = $this->cacheDir . DS . "download.tmp"; + $fileDownloadCache = $this->cacheDir . DS . md5(uniqid()) . ".tmp"; $this->copyFile($filePath, $fileDownloadCache, $isOnline); /** @@ -202,7 +202,7 @@ class TarArchiveBuilder extends AbstractArchiveBuilder */ public function getFileContent($pathToFile) { - + } diff --git a/core/lib/Thelia/Core/FileFormat/Archive/ArchiveBuilderInterface.php b/core/lib/Thelia/Core/FileFormat/Archive/ArchiveBuilderInterface.php index 2365ee624..88f5da78f 100644 --- a/core/lib/Thelia/Core/FileFormat/Archive/ArchiveBuilderInterface.php +++ b/core/lib/Thelia/Core/FileFormat/Archive/ArchiveBuilderInterface.php @@ -18,7 +18,7 @@ use Thelia\Tools\FileDownload\FileDownloaderInterface; * @package Thelia\Core\FileFormat\Archive * @author Benjamin Perche * - * This interface defines the methods that an archive creator must have. + * This interface defines the methods that an archive builder must have. */ interface ArchiveBuilderInterface { diff --git a/core/lib/Thelia/Tests/FileFormat/Archive/ArchiveBuilder/TarArchiveBuilderTest.php b/core/lib/Thelia/Tests/FileFormat/Archive/ArchiveBuilder/TarArchiveBuilderTest.php index df48f0629..269de3c91 100644 --- a/core/lib/Thelia/Tests/FileFormat/Archive/ArchiveBuilder/TarArchiveBuilderTest.php +++ b/core/lib/Thelia/Tests/FileFormat/Archive/ArchiveBuilder/TarArchiveBuilderTest.php @@ -83,4 +83,11 @@ class TarArchiveBuilderTest extends \PHPUnit_Framework_TestCase $this->assertTrue($this->tar->hasDirectory("bar")); } + + public function testAddValidFileFromString() + { + $this->tar->addFileFromString( + + ) + } } \ No newline at end of file diff --git a/core/lib/Thelia/Tests/FileFormat/Archive/ArchiveBuilder/ZipArchiveBuilderTest.php b/core/lib/Thelia/Tests/FileFormat/Archive/ArchiveBuilder/ZipArchiveBuilderTest.php index 0ad6ca76c..7fd5aeed8 100644 --- a/core/lib/Thelia/Tests/FileFormat/Archive/ArchiveBuilder/ZipArchiveBuilderTest.php +++ b/core/lib/Thelia/Tests/FileFormat/Archive/ArchiveBuilder/ZipArchiveBuilderTest.php @@ -354,6 +354,19 @@ class ZipArchiveBuilderTest extends \PHPUnit_Framework_TestCase "foo", $this->loadedZip->getFileContent("bar") ); + + $this->loadedZip->addFileFromString( + "foo", "bar", "baz" + ); + + $this->assertTrue( + $this->loadedZip->hasFile("baz/bar") + ); + + $this->assertEquals( + "foo", + $this->loadedZip->getFileContent("baz/bar") + ); } /**