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:
@@ -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)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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(
|
||||||
|
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -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")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user