Complete zip tests

modifié:         core/lib/Thelia/Core/FileFormat/Archive/ArchiveBuilder/TarArchiveBuilder.php
	modifié:         core/lib/Thelia/Core/FileFormat/Archive/ArchiveBuilderInterface.php
	modifié:         core/lib/Thelia/Tests/FileFormat/Archive/ArchiveBuilder/TarArchiveBuilderTest.php
	modifié:         core/lib/Thelia/Tests/FileFormat/Archive/ArchiveBuilder/ZipArchiveBuilderTest.php
This commit is contained in:
Benjamin Perche
2014-07-03 13:38:40 +02:00
parent e72d3bfb60
commit 21bf9fd0e2
4 changed files with 23 additions and 3 deletions

View File

@@ -101,7 +101,7 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
* Download the file if it is online * Download the file if it is online
* If it's local check if the file exists and if it is redable * 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); $this->copyFile($filePath, $fileDownloadCache, $isOnline);
/** /**
@@ -202,7 +202,7 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
*/ */
public function getFileContent($pathToFile) public function getFileContent($pathToFile)
{ {
} }

View File

@@ -18,7 +18,7 @@ use Thelia\Tools\FileDownload\FileDownloaderInterface;
* @package Thelia\Core\FileFormat\Archive * @package Thelia\Core\FileFormat\Archive
* @author Benjamin Perche <bperche@openstudio.fr> * @author Benjamin Perche <bperche@openstudio.fr>
* *
* This interface defines the methods that an archive creator must have. * This interface defines the methods that an archive builder must have.
*/ */
interface ArchiveBuilderInterface interface ArchiveBuilderInterface
{ {

View File

@@ -83,4 +83,11 @@ class TarArchiveBuilderTest extends \PHPUnit_Framework_TestCase
$this->assertTrue($this->tar->hasDirectory("bar")); $this->assertTrue($this->tar->hasDirectory("bar"));
} }
public function testAddValidFileFromString()
{
$this->tar->addFileFromString(
)
}
} }

View File

@@ -354,6 +354,19 @@ class ZipArchiveBuilderTest extends \PHPUnit_Framework_TestCase
"foo", "foo",
$this->loadedZip->getFileContent("bar") $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")
);
} }
/** /**