Finish tar, tar.gz, tar.bz2 and tests
modifié: core/lib/Thelia/Config/Resources/config.xml modifié: core/lib/Thelia/Core/FileFormat/Archive/AbstractArchiveBuilder.php modifié: core/lib/Thelia/Core/FileFormat/Archive/ArchiveBuilder/TarArchiveBuilder.php nouveau fichier: core/lib/Thelia/Core/FileFormat/Archive/ArchiveBuilder/TarBz2ArchiveBuilder.php nouveau fichier: core/lib/Thelia/Core/FileFormat/Archive/ArchiveBuilder/TarGzArchiveBuilder.php modifié: core/lib/Thelia/Core/FileFormat/Archive/ArchiveBuilder/ZipArchiveBuilder.php modifié: core/lib/Thelia/Core/FileFormat/Archive/ArchiveBuilderInterface.php modifié: core/lib/Thelia/Tests/FileFormat/Archive/ArchiveBuilder/TarArchiveBuilderTest.php nouveau fichier: core/lib/Thelia/Tests/FileFormat/Archive/ArchiveBuilder/TarBz2ArchiveBuilderTest.php nouveau fichier: core/lib/Thelia/Tests/FileFormat/Archive/ArchiveBuilder/TarGzArchiveBuilderTest.php modifié: core/lib/Thelia/Tests/FileFormat/Archive/ArchiveBuilder/ZipArchiveBuilderTest.php
This commit is contained in:
@@ -150,18 +150,18 @@
|
||||
</service>
|
||||
|
||||
<!-- tar -->
|
||||
<service id="thelia.manager.tar_archive_builder" class="Thelia\Core\FileFormat\Archive\ArchiveBuilder\ZipArchiveBuilder">
|
||||
<service id="thelia.manager.tar_archive_builder" class="Thelia\Core\FileFormat\Archive\ArchiveBuilder\TarArchiveBuilder">
|
||||
<tag name="thelia.manager.archive_builder" />
|
||||
</service>
|
||||
|
||||
<!-- tar.gz -->
|
||||
<service id="thelia.manager.tar_gz_archive_builder" class="Thelia\Core\FileFormat\Archive\ArchiveBuilder\ZipArchiveBuilder">
|
||||
<service id="thelia.manager.tar_gz_archive_builder" class="Thelia\Core\FileFormat\Archive\ArchiveBuilder\TarGzArchiveBuilder">
|
||||
<argument id="compressionType" type="string">gz</argument>
|
||||
<tag name="thelia.manager.archive_builder" />
|
||||
</service>
|
||||
|
||||
<!-- tar.bz2 -->
|
||||
<service id="thelia.manager.tar_bz2_archive_builder" class="Thelia\Core\FileFormat\Archive\ArchiveBuilder\ZipArchiveBuilder">
|
||||
<service id="thelia.manager.tar_bz2_archive_builder" class="Thelia\Core\FileFormat\Archive\ArchiveBuilder\TarBz2ArchiveBuilder">
|
||||
<argument id="compressionType" type="string">bz2</argument>
|
||||
<tag name="thelia.manager.archive_builder" />
|
||||
</service>
|
||||
|
||||
@@ -62,12 +62,18 @@ abstract class AbstractArchiveBuilder implements FormatInterface, ArchiveBuilder
|
||||
/** @var string */
|
||||
protected $cacheDir;
|
||||
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
/** @var string */
|
||||
protected $environment;
|
||||
|
||||
=======
|
||||
>>>>>>> Begin tar, tar.bz2 and tar.gz formatter, fix zip test resources
|
||||
=======
|
||||
/** @var string */
|
||||
protected $environment;
|
||||
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
public function __construct()
|
||||
{
|
||||
$this->translator = Translator::getInstance();
|
||||
@@ -244,10 +250,16 @@ abstract class AbstractArchiveBuilder implements FormatInterface, ArchiveBuilder
|
||||
{
|
||||
return $this->cacheFile;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
|
||||
/**
|
||||
* @param string $environment
|
||||
=======
|
||||
|
||||
/**
|
||||
* @param string $environment
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
* @return $this
|
||||
*
|
||||
* Sets the execution environment of the Kernel,
|
||||
@@ -257,6 +269,7 @@ abstract class AbstractArchiveBuilder implements FormatInterface, ArchiveBuilder
|
||||
{
|
||||
$this->environment = $environment;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
=======
|
||||
}
|
||||
@@ -267,3 +280,6 @@ abstract class AbstractArchiveBuilder implements FormatInterface, ArchiveBuilder
|
||||
=======
|
||||
}
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
=======
|
||||
}
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
|
||||
@@ -60,6 +60,7 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
/** @var \Thelia\Log\Tlog */
|
||||
protected $logger;
|
||||
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
function __construct($compressionType = null)
|
||||
@@ -90,6 +91,8 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
=======
|
||||
|
||||
>>>>>>> Finish Tar archive builder
|
||||
=======
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
public function __destruct()
|
||||
{
|
||||
if ($this->tar instanceof \PharData) {
|
||||
@@ -433,6 +436,7 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
*
|
||||
* Loads an archive
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
public function loadArchive($pathToArchive, $isOnline = false)
|
||||
{
|
||||
@@ -463,11 +467,21 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
$instance->setCacheFile($instance->generateCacheFile($environment))
|
||||
->copyFile($pathToArchive, $instance->getCacheFile(), $isOnline);
|
||||
>>>>>>> Fix FileDownloader test
|
||||
=======
|
||||
public function loadArchive($pathToArchive, $isOnline = false)
|
||||
{
|
||||
$tar = clone $this;
|
||||
|
||||
$tar
|
||||
->setCacheFile($tar->generateCacheFile($this->environment))
|
||||
->copyFile($pathToArchive, $tar->getCacheFile(), $isOnline);
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
|
||||
/**
|
||||
* This throws TarArchiveBuilderException if
|
||||
* the archive is not valid.
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
|
||||
return $tar->setEnvironment($tar->environment);
|
||||
@@ -476,6 +490,9 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
|
||||
return $instance;
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
=======
|
||||
return $tar->setEnvironment($tar->environment);
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -566,6 +583,9 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
public function setEnvironment($environment)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
if (empty($environment)) {
|
||||
throw new \ErrorException(
|
||||
$this->translator->trans(
|
||||
@@ -574,8 +594,11 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
=======
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
if ($this->cacheFile === null) {
|
||||
$cacheFile = $this->generateCacheFile($environment);
|
||||
|
||||
@@ -591,6 +614,7 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
try {
|
||||
$this->tar = new \PharData($cacheFile, null, null, static::PHAR_FORMAT);
|
||||
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
$this->compressionEntryPoint();
|
||||
|
||||
@@ -606,6 +630,10 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
$cacheFile .= ".bz2";
|
||||
break;
|
||||
}
|
||||
=======
|
||||
$this->compressionEntryPoint();
|
||||
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
|
||||
} catch(\BadMethodCallException $e) {
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
@@ -633,10 +661,14 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
}
|
||||
|
||||
$this->cacheFile = $cacheFile;
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
$this->environment = $environment;
|
||||
=======
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
=======
|
||||
$this->environment = $environment;
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -693,6 +725,7 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
return "tar";
|
||||
=======
|
||||
@@ -704,6 +737,9 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
|
||||
return $name;
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
=======
|
||||
return "tar";
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -717,11 +753,15 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
*/
|
||||
public function getExtension()
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
return "tar";
|
||||
=======
|
||||
return $this->getName();
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
=======
|
||||
return "tar";
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -735,6 +775,9 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
public function getMimeType()
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
return "application/x-tar";
|
||||
}
|
||||
|
||||
@@ -744,6 +787,7 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
* This method must be overwritten if you want to do some
|
||||
* stuff to compress you archive
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
|
||||
public function getCompression()
|
||||
@@ -760,3 +804,12 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
|
||||
}
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
=======
|
||||
}
|
||||
|
||||
public function getCompression()
|
||||
{
|
||||
return $this->compression;
|
||||
}
|
||||
}
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
|
||||
@@ -44,4 +44,8 @@ class TarBz2ArchiveBuilder extends TarArchiveBuilder
|
||||
|
||||
return $this;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
=======
|
||||
}
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
|
||||
@@ -49,4 +49,8 @@ class TarGzArchiveBuilder extends TarArchiveBuilder
|
||||
return $this;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
=======
|
||||
}
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
|
||||
@@ -373,6 +373,7 @@ class ZipArchiveBuilder extends AbstractArchiveBuilder
|
||||
* If it's local check if the file exists and if it is redable
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
>>>>>>> Begin tar, tar.bz2 and tar.gz formatter, fix zip test resources
|
||||
if ($isOnline) {
|
||||
$fileDownloadCache = $this->cacheDir . DS . "download";
|
||||
@@ -403,6 +404,9 @@ class ZipArchiveBuilder extends AbstractArchiveBuilder
|
||||
}
|
||||
=======
|
||||
$fileDownloadCache = $this->cacheDir . DS . "download.tmp";
|
||||
=======
|
||||
$fileDownloadCache = $this->cacheDir . DS . md5(uniqid()) . ".tmp";
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
$this->copyFile($filePath, $fileDownloadCache, $isOnline);
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
|
||||
@@ -421,9 +425,15 @@ class ZipArchiveBuilder extends AbstractArchiveBuilder
|
||||
|
||||
$this->logger->error($translatedErrorMessage);
|
||||
|
||||
// if error delete the cache file
|
||||
unlink($fileDownloadCache);
|
||||
|
||||
throw new \ErrorException($translatedErrorMessage);
|
||||
}
|
||||
|
||||
// If not too
|
||||
unlink($fileDownloadCache);
|
||||
|
||||
$this->commit();
|
||||
|
||||
return $this;
|
||||
@@ -714,23 +724,30 @@ class ZipArchiveBuilder extends AbstractArchiveBuilder
|
||||
* @return ZipArchiveBuilder
|
||||
=======
|
||||
* @param string $pathToArchive
|
||||
* @param string $environment
|
||||
* @param bool $isOnline
|
||||
* @param FileDownloaderInterface $fileDownloader
|
||||
<<<<<<< HEAD
|
||||
* @return $this
|
||||
>>>>>>> Define archive builders and formatters
|
||||
=======
|
||||
* @return ZipArchiveBuilder
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
* @throws \Thelia\Exception\FileNotFoundException
|
||||
* @throws \Thelia\Exception\HttpUrlException
|
||||
*
|
||||
* Loads an archive
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
public function loadArchive($pathToArchive, $isOnline = false)
|
||||
{
|
||||
$back = $this->zip;
|
||||
$this->zip = new \ZipArchive();
|
||||
$zip = clone $this;
|
||||
$this->zip = $back;
|
||||
<<<<<<< HEAD
|
||||
|
||||
$zip->setEnvironment($this->environment);
|
||||
|
||||
@@ -764,17 +781,29 @@ class ZipArchiveBuilder extends AbstractArchiveBuilder
|
||||
if ($fileDownloader !== null) {
|
||||
$instance->setFileDownloader($fileDownloader);
|
||||
}
|
||||
=======
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
|
||||
$instance->copyFile($pathToArchive, $instance->getCacheFile(), $isOnline);
|
||||
$zip->setEnvironment($this->environment);
|
||||
|
||||
if (true !== $return = $zip->open($instance->getCacheFile())) {
|
||||
$zip->copyFile(
|
||||
$pathToArchive,
|
||||
$zip->getCacheFile(),
|
||||
$isOnline
|
||||
);
|
||||
|
||||
if (true !== $return = $zip->getRawZipArchive()->open($zip->getCacheFile())) {
|
||||
throw new ZipArchiveException(
|
||||
$instance->getZipErrorMessage($return)
|
||||
$zip->getZipErrorMessage($return)
|
||||
);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
return $instance;
|
||||
>>>>>>> Define archive builders and formatters
|
||||
=======
|
||||
return $zip;
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -837,6 +866,7 @@ class ZipArchiveBuilder extends AbstractArchiveBuilder
|
||||
public function setEnvironment($environment)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
parent::setEnvironment($environment);
|
||||
|
||||
@@ -874,6 +904,9 @@ class ZipArchiveBuilder extends AbstractArchiveBuilder
|
||||
$cacheFile .= "." . $this->getExtension();
|
||||
>>>>>>> Define archive builders and formatters
|
||||
=======
|
||||
=======
|
||||
parent::setEnvironment($environment);
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
|
||||
<<<<<<< HEAD
|
||||
$cacheFileName = md5 (uniqid());
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\FileFormat\Archive;
|
||||
use Thelia\Tools\FileDownload\FileDownloaderInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Interface ArchiveBuilderInterface
|
||||
@@ -150,13 +150,15 @@ interface ArchiveBuilderInterface
|
||||
|
||||
/**
|
||||
* @param string $pathToArchive
|
||||
* @param string $environment
|
||||
* @param bool $isOnline
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
>>>>>>> Define archive builders and formatters
|
||||
=======
|
||||
* @param FileDownloaderInterface $fileDownloader
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
=======
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
* @return $this
|
||||
* @throws \Thelia\Exception\FileNotFoundException
|
||||
* @throws \Thelia\Exception\HttpUrlException
|
||||
@@ -164,6 +166,7 @@ interface ArchiveBuilderInterface
|
||||
* Loads an archive
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
public function loadArchive($pathToArchive, $isOnline = false);
|
||||
=======
|
||||
@@ -172,6 +175,9 @@ interface ArchiveBuilderInterface
|
||||
=======
|
||||
public static function loadArchive($pathToArchive, $environment, $isOnline = false, FileDownloaderInterface $fileDownloader = null);
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
=======
|
||||
public function loadArchive($pathToArchive, $isOnline = false);
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
|
||||
/**
|
||||
* @param $pathToFile
|
||||
@@ -193,6 +199,7 @@ interface ArchiveBuilderInterface
|
||||
*/
|
||||
public function hasDirectory($directory);
|
||||
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
=======
|
||||
@@ -206,3 +213,6 @@ interface ArchiveBuilderInterface
|
||||
public function setEnvironment($environment);
|
||||
}
|
||||
>>>>>>> Define archive builders and formatters
|
||||
=======
|
||||
}
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
|
||||
@@ -381,9 +381,8 @@ class TarArchiveBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testLoadValidArchive()
|
||||
{
|
||||
$tar = TarArchiveBuilder::loadArchive(
|
||||
__DIR__ . DS . "TestResources/well_formatted.tar",
|
||||
"dev"
|
||||
$tar = $this->tar->loadArchive(
|
||||
__DIR__ . DS . "TestResources/well_formatted.tar"
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
@@ -401,9 +400,8 @@ class TarArchiveBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testLoadInvalidArchive()
|
||||
{
|
||||
$tar = TarArchiveBuilder::loadArchive(
|
||||
__DIR__ . DS . "TestResources/bad_formatted.tar",
|
||||
"dev"
|
||||
$tar = $this->tar->loadArchive(
|
||||
__DIR__ . DS . "TestResources/bad_formatted.tar"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -512,5 +510,17 @@ class TarArchiveBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
$this->tar->formatFilePath("//foo/bar///baz/")
|
||||
);
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
>>>>>>> Finish Tar archive builder
|
||||
=======
|
||||
|
||||
public function testCompression()
|
||||
{
|
||||
$this->assertEquals(
|
||||
null,
|
||||
$this->tar->getCompression()
|
||||
);
|
||||
}
|
||||
}
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
|
||||
@@ -35,4 +35,8 @@ class TarBz2ArchiveBuilderTest extends TarArchiveBuilderTest
|
||||
$this->tar->getCompression()
|
||||
);
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
=======
|
||||
}
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
|
||||
namespace Thelia\Tests\FileFormat\Archive\ArchiveBuilder;
|
||||
use Thelia\Core\FileFormat\Archive\ArchiveBuilder\TarGzArchiveBuilder;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
use Thelia\Core\HttpFoundation\Response;
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
|
||||
/**
|
||||
* Class TarGzArchiveBuilderTest
|
||||
@@ -35,4 +39,8 @@ class TarGzArchiveBuilderTest extends TarArchiveBuilderTest
|
||||
$this->tar->getCompression()
|
||||
);
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
=======
|
||||
}
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
|
||||
@@ -40,6 +40,7 @@ class ZipArchiveBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$this->zip = new ZipArchiveBuilder();
|
||||
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
$this->zip->setEnvironment("dev");
|
||||
|
||||
@@ -50,6 +51,12 @@ class ZipArchiveBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
__DIR__ . DS . "TestResources/well_formatted.zip",
|
||||
"dev"
|
||||
>>>>>>> Define archive builders and formatters
|
||||
=======
|
||||
$this->zip->setEnvironment("dev");
|
||||
|
||||
$this->loadedZip = $this->zip->loadArchive(
|
||||
__DIR__ . DS . "TestResources/well_formatted.zip"
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
);
|
||||
}
|
||||
|
||||
@@ -342,12 +349,16 @@ class ZipArchiveBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
public function testLoadValidZip()
|
||||
{
|
||||
$loadedZip = $this->zip->loadArchive(
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
__DIR__ . DS . "TestResources/well_formatted.zip"
|
||||
=======
|
||||
__DIR__ . DS . "TestResources/well_formatted.zip",
|
||||
"dev"
|
||||
>>>>>>> Define archive builders and formatters
|
||||
=======
|
||||
__DIR__ . DS . "TestResources/well_formatted.zip"
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
@@ -371,12 +382,16 @@ class ZipArchiveBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
public function testLoadNotValidZip()
|
||||
{
|
||||
$this->zip->loadArchive(
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
__DIR__ . DS . "TestResources/bad_formatted.zip"
|
||||
=======
|
||||
__DIR__ . DS . "TestResources/bad_formatted.zip",
|
||||
"dev"
|
||||
>>>>>>> Define archive builders and formatters
|
||||
=======
|
||||
__DIR__ . DS . "TestResources/bad_formatted.zip"
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
);
|
||||
}
|
||||
|
||||
@@ -386,17 +401,22 @@ class ZipArchiveBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
public function testLoadNotExistingFile()
|
||||
{
|
||||
$this->zip->loadArchive(
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
__DIR__ . DS . "TestResources/this_file_doesn_t_exist.zip"
|
||||
=======
|
||||
__DIR__ . DS . "TestResources/this_file_doesn_t_exist.zip",
|
||||
"dev"
|
||||
>>>>>>> Define archive builders and formatters
|
||||
=======
|
||||
__DIR__ . DS . "TestResources/this_file_doesn_t_exist.zip"
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
);
|
||||
}
|
||||
|
||||
public function testLoadOnlineAvailableAndValidFile()
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
$this->zip->setFileDownloader(FakeFileDownloader::getInstance());
|
||||
|
||||
@@ -410,6 +430,13 @@ class ZipArchiveBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
true,
|
||||
FakeFileDownloader::getInstance()
|
||||
>>>>>>> Define archive builders and formatters
|
||||
=======
|
||||
$this->zip->setFileDownloader(FakeFileDownloader::getInstance());
|
||||
|
||||
$this->zip->loadArchive(
|
||||
__DIR__ . DS . "TestResources/well_formatted.zip",
|
||||
true
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
);
|
||||
}
|
||||
|
||||
@@ -427,6 +454,7 @@ class ZipArchiveBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testLoadOnlineAvailableAndNotValidFile()
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
$this->zip->setFileDownloader(FakeFileDownloader::getInstance());
|
||||
|
||||
@@ -440,6 +468,13 @@ class ZipArchiveBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
true,
|
||||
FakeFileDownloader::getInstance()
|
||||
>>>>>>> Define archive builders and formatters
|
||||
=======
|
||||
$this->zip->setFileDownloader(FakeFileDownloader::getInstance());
|
||||
|
||||
$this->zip->loadArchive(
|
||||
__DIR__ . DS . "TestResources/bad_formatted.zip",
|
||||
true
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
);
|
||||
}
|
||||
|
||||
@@ -448,6 +483,7 @@ class ZipArchiveBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testLoadOnlineNotExistingFile()
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
$this->zip->setFileDownloader(FakeFileDownloader::getInstance());
|
||||
|
||||
@@ -461,6 +497,13 @@ class ZipArchiveBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
true,
|
||||
FakeFileDownloader::getInstance()
|
||||
>>>>>>> Define archive builders and formatters
|
||||
=======
|
||||
$this->zip->setFileDownloader(FakeFileDownloader::getInstance());
|
||||
|
||||
$this->zip->loadArchive(
|
||||
__DIR__ . DS . "TestResources/this_file_doesn_t_exist.zip",
|
||||
true
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user