Revert files

modifié:         core/lib/Thelia/Core/FileFormat/Archive/AbstractArchiveBuilder.php
	modifié:         core/lib/Thelia/Core/FileFormat/Archive/ArchiveBuilder/Exception/TarArchiveException.php
	supprimé:        core/lib/Thelia/Core/FileFormat/Archive/ArchiveBuilder/Exception/ZipArchiveException.php~HEAD
	modifié:         core/lib/Thelia/Core/FileFormat/Archive/ArchiveBuilder/TarArchiveBuilder.php
	modifié:         core/lib/Thelia/Core/FileFormat/Archive/ArchiveBuilder/TarBz2ArchiveBuilder.php
	modifié:         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/Core/FileFormat/Archive/ArchiveBuilderManager.php
	modifié:         core/lib/Thelia/Core/FileFormat/FormatInterface.php
	modifié:         core/lib/Thelia/Core/FileFormat/Formatting/AbstractFormatter.php
	nouveau fichier: core/lib/Thelia/Core/FileFormat/Formatting/Formatter/JsonFormatter.php
	nouveau fichier: core/lib/Thelia/Core/FileFormat/Formatting/Formatter/XMLFormatter.php
	modifié:         core/lib/Thelia/Core/FileFormat/Formatting/FormatterData.php
	modifié:         core/lib/Thelia/Tests/Action/FolderTest.php
	modifié:         core/lib/Thelia/Tests/FileFormat/Archive/ArchiveBuilder/TarArchiveBuilderTest.php
	modifié:         core/lib/Thelia/Tests/FileFormat/Archive/ArchiveBuilder/TarBz2ArchiveBuilderTest.php
	modifié:         core/lib/Thelia/Tests/FileFormat/Archive/ArchiveBuilder/TarGzArchiveBuilderTest.php
	modifié:         core/lib/Thelia/Tests/FileFormat/Archive/ArchiveBuilder/TestResources/bad_formatted.tar
	modifié:         core/lib/Thelia/Tests/FileFormat/Archive/ArchiveBuilder/ZipArchiveBuilderTest.php
	modifié:         core/lib/Thelia/Tests/FileFormat/Archive/ArchiveBuilderManagerTest.php
	nouveau fichier: core/lib/Thelia/Tests/FileFormat/Formatting/Formatter/XMLFormatterTest.php
	modifié:         core/lib/Thelia/Tests/FileFormat/Formatting/FormatterDataTest.php
	modifié:         core/lib/Thelia/Tests/Tools/FakeFileDownloader.php
	modifié:         core/lib/Thelia/Tests/Tools/FileDownloaderTest.php
	modifié:         core/lib/Thelia/Tools/FileDownload/FileDownloader.php
	modifié:         core/lib/Thelia/Tools/FileDownload/FileDownloaderAwareTrait.php
	modifié:         core/lib/Thelia/Tools/FileDownload/FileDownloaderInterface.php
This commit is contained in:
Benjamin Perche
2014-07-10 14:04:26 +02:00
parent fa7b02c9c9
commit 45bb5a7bfb
27 changed files with 412 additions and 2211 deletions

View File

@@ -33,26 +33,11 @@ class TarArchiveBuilderTest extends \PHPUnit_Framework_TestCase
Tlog::getNewInstance();
$this->tar = new TarArchiveBuilder();
<<<<<<< HEAD
<<<<<<< HEAD
$this->tar->setEnvironment("dev");
=======
>>>>>>> Finish implementing and testing zip
=======
$this->tar->setEnvironment("dev");
>>>>>>> Fix FileDownloader test
}
public function testAddFileAndDirectory()
{
<<<<<<< HEAD
<<<<<<< HEAD
=======
$this->tar->setEnvironment("dev");
>>>>>>> Finish implementing and testing zip
=======
>>>>>>> Fix FileDownloader test
/**
* File
*/
@@ -97,20 +82,10 @@ class TarArchiveBuilderTest extends \PHPUnit_Framework_TestCase
$this->assertTrue($this->tar->hasDirectory("bar"));
}
<<<<<<< HEAD
<<<<<<< HEAD
=======
>>>>>>> Complete zip tests
public function testAddValidFileFromString()
{
<<<<<<< HEAD
<<<<<<< HEAD
$this->tar->addFileFromString(
<<<<<<< HEAD
=======
$this->tar->addFileFromString(
>>>>>>> Fix FileDownloader test
"foo", "bar"
);
@@ -122,7 +97,6 @@ class TarArchiveBuilderTest extends \PHPUnit_Framework_TestCase
"foo",
$this->tar->getFileContent("bar")
);
<<<<<<< HEAD
$this->tar->addFileFromString(
"foo", "bar", "baz"
@@ -315,216 +289,3 @@ class TarArchiveBuilderTest extends \PHPUnit_Framework_TestCase
);
}
}
=======
}
>>>>>>> Finish implementing and testing zip
=======
=======
>>>>>>> Fix FileDownloader test
=======
>>>>>>> Fix FileDownloader test
$this->tar->addFileFromString(
"foo", "bar", "baz"
);
$this->assertTrue(
$this->tar->hasFile("baz/bar")
);
$this->assertEquals(
"foo",
$this->tar->getFileContent("baz/bar")
);
}
/**
* @expectedException \ErrorException
*/
public function testAddNotValidFileFromString()
{
$this->tar->addFileFromString(
"foo", $this
);
}
/**
* @expectedException \ErrorException
*/
public function testAddNotValidFileValueFromString()
{
$this->tar->addFileFromString(
$this, "foo"
);
}
public function testDeleteFile()
{
$this->tar->addFileFromString(
"foo", "bar"
);
$this->assertTrue(
$this->tar->hasFile("bar")
);
$this->tar->deleteFile("bar");
$this->assertFalse(
$this->tar->hasFile("bar")
);
}
<<<<<<< HEAD
}
>>>>>>> Complete zip tests
=======
public function testLoadValidArchive()
{
$tar = $this->tar->loadArchive(
__DIR__ . DS . "TestResources/well_formatted.tar"
);
$this->assertInstanceOf(
get_class($this->tar),
$tar
);
$this->assertTrue(
$tar->hasFile("LICENSE.txt")
);
}
/**
* @expectedException \Thelia\Core\FileFormat\Archive\ArchiveBuilder\Exception\TarArchiveException
*/
public function testLoadInvalidArchive()
{
$tar = $this->tar->loadArchive(
__DIR__ . DS . "TestResources/bad_formatted.tar"
);
}
public function testFormatDirectoryPath()
{
$this->assertEquals(
"foo/",
$this->tar->formatDirectoryPath("foo")
);
$this->assertEquals(
"foo/",
$this->tar->formatDirectoryPath("/foo")
);
$this->assertEquals(
"foo/",
$this->tar->formatDirectoryPath("foo/")
);
$this->assertEquals(
"foo/",
$this->tar->formatDirectoryPath("/foo/")
);
$this->assertEquals(
"foo/bar/",
$this->tar->formatDirectoryPath("foo/bar")
);
$this->assertEquals(
"foo/bar/",
$this->tar->formatDirectoryPath("/foo/bar")
);
$this->assertEquals(
"foo/bar/",
$this->tar->formatDirectoryPath("/foo//bar/")
);
$this->assertEquals(
"foo/bar/",
$this->tar->formatDirectoryPath("/foo/bar/")
);
$this->assertEquals(
"foo/bar/baz/",
$this->tar->formatDirectoryPath("foo/bar/baz")
);
$this->assertEquals(
"foo/bar/baz/",
$this->tar->formatDirectoryPath("//foo/bar///baz/")
);
}
public function testFormatFilePath()
{
$this->assertEquals(
"foo",
$this->tar->formatFilePath("foo")
);
$this->assertEquals(
"foo",
$this->tar->formatFilePath("/foo")
);
$this->assertEquals(
"foo",
$this->tar->formatFilePath("foo/")
);
$this->assertEquals(
"foo",
$this->tar->formatFilePath("/foo/")
);
$this->assertEquals(
"foo/bar",
$this->tar->formatFilePath("foo/bar")
);
$this->assertEquals(
"foo/bar",
$this->tar->formatFilePath("/foo/bar")
);
$this->assertEquals(
"foo/bar",
$this->tar->formatFilePath("/foo//bar/")
);
$this->assertEquals(
"foo/bar",
$this->tar->formatFilePath("/foo/bar/")
);
$this->assertEquals(
"foo/bar/baz",
$this->tar->formatFilePath("foo/bar/baz")
);
$this->assertEquals(
"foo/bar/baz",
$this->tar->formatFilePath("//foo/bar///baz/")
);
}
<<<<<<< HEAD
}
>>>>>>> Finish Tar archive builder
=======
public function testCompression()
{
$this->assertEquals(
null,
$this->tar->getCompression()
);
}
<<<<<<< HEAD
}
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
=======
}
>>>>>>> Fix cs

View File

@@ -35,12 +35,4 @@ class TarBz2ArchiveBuilderTest extends TarArchiveBuilderTest
$this->tar->getCompression()
);
}
<<<<<<< HEAD
<<<<<<< HEAD
}
=======
}
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
=======
}
>>>>>>> Fix cs

View File

@@ -12,13 +12,6 @@
namespace Thelia\Tests\FileFormat\Archive\ArchiveBuilder;
use Thelia\Core\FileFormat\Archive\ArchiveBuilder\TarGzArchiveBuilder;
<<<<<<< HEAD
<<<<<<< HEAD
=======
use Thelia\Core\HttpFoundation\Response;
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
=======
>>>>>>> Fix cs
/**
* Class TarGzArchiveBuilderTest
@@ -42,12 +35,4 @@ class TarGzArchiveBuilderTest extends TarArchiveBuilderTest
$this->tar->getCompression()
);
}
<<<<<<< HEAD
<<<<<<< HEAD
}
=======
}
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
=======
}
>>>>>>> Fix cs

View File

@@ -40,325 +40,126 @@ class ZipArchiveBuilderTest extends \PHPUnit_Framework_TestCase
$this->zip = new ZipArchiveBuilder();
<<<<<<< HEAD
<<<<<<< HEAD
$this->zip->setEnvironment("dev");
$this->loadedZip = $this->zip->loadArchive(
__DIR__ . DS . "TestResources/well_formatted.zip"
=======
$this->loadedZip = $this->zip->loadArchive(
__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
);
}
/**
* This method formats a path to be compatible with \ZipArchive
<<<<<<< HEAD
<<<<<<< HEAD
*/
public function testFormatFilePath()
{
$this->assertEquals(
"foo",
$this->zip->formatFilePath("foo")
=======
*
*
=======
>>>>>>> Begin tar, tar.bz2 and tar.gz formatter, fix zip test resources
*/
public function testFormatFilePath()
{
$this->assertEquals(
"foo",
<<<<<<< HEAD
$this->zip->getFilePath("foo")
>>>>>>> Define archive builders and formatters
=======
$this->zip->formatFilePath("foo")
>>>>>>> Finish implementing and testing zip
);
$this->assertEquals(
"foo",
<<<<<<< HEAD
<<<<<<< HEAD
$this->zip->formatFilePath("/foo")
=======
$this->zip->getFilePath("/foo")
>>>>>>> Define archive builders and formatters
=======
$this->zip->formatFilePath("/foo")
>>>>>>> Finish implementing and testing zip
);
$this->assertEquals(
"foo",
<<<<<<< HEAD
<<<<<<< HEAD
$this->zip->formatFilePath("foo/")
=======
$this->zip->getFilePath("foo/")
>>>>>>> Define archive builders and formatters
=======
$this->zip->formatFilePath("foo/")
>>>>>>> Finish implementing and testing zip
);
$this->assertEquals(
"foo",
<<<<<<< HEAD
<<<<<<< HEAD
$this->zip->formatFilePath("/foo/")
=======
$this->zip->getFilePath("/foo/")
>>>>>>> Define archive builders and formatters
=======
$this->zip->formatFilePath("/foo/")
>>>>>>> Finish implementing and testing zip
);
$this->assertEquals(
"/foo/bar",
<<<<<<< HEAD
<<<<<<< HEAD
$this->zip->formatFilePath("foo/bar")
=======
$this->zip->getFilePath("foo/bar")
>>>>>>> Define archive builders and formatters
=======
$this->zip->formatFilePath("foo/bar")
>>>>>>> Finish implementing and testing zip
);
$this->assertEquals(
"/foo/bar",
<<<<<<< HEAD
<<<<<<< HEAD
$this->zip->formatFilePath("/foo/bar")
=======
$this->zip->getFilePath("/foo/bar")
>>>>>>> Define archive builders and formatters
=======
$this->zip->formatFilePath("/foo/bar")
>>>>>>> Finish implementing and testing zip
);
$this->assertEquals(
"/foo/bar",
<<<<<<< HEAD
<<<<<<< HEAD
$this->zip->formatFilePath("/foo//bar/")
=======
$this->zip->getFilePath("/foo//bar/")
>>>>>>> Define archive builders and formatters
=======
$this->zip->formatFilePath("/foo//bar/")
>>>>>>> Finish implementing and testing zip
);
$this->assertEquals(
"/foo/bar",
<<<<<<< HEAD
<<<<<<< HEAD
$this->zip->formatFilePath("/foo/bar/")
=======
$this->zip->getFilePath("/foo/bar/")
>>>>>>> Define archive builders and formatters
=======
$this->zip->formatFilePath("/foo/bar/")
>>>>>>> Finish implementing and testing zip
);
$this->assertEquals(
"/foo/bar/baz",
<<<<<<< HEAD
<<<<<<< HEAD
$this->zip->formatFilePath("foo/bar/baz")
=======
$this->zip->getFilePath("foo/bar/baz")
>>>>>>> Define archive builders and formatters
=======
$this->zip->formatFilePath("foo/bar/baz")
>>>>>>> Finish implementing and testing zip
);
$this->assertEquals(
"/foo/bar/baz",
<<<<<<< HEAD
<<<<<<< HEAD
$this->zip->formatFilePath("//foo/bar///baz/")
);
}
public function testFormatDirectoryPath()
<<<<<<< HEAD
{
$this->assertEquals(
"/foo/",
$this->zip->formatDirectoryPath("foo")
=======
$this->zip->getFilePath("//foo/bar///baz/")
=======
$this->zip->formatFilePath("//foo/bar///baz/")
>>>>>>> Finish implementing and testing zip
);
}
public function testGetDirectoryPath()
=======
>>>>>>> Finish Tar archive builder
{
$this->assertEquals(
"/foo/",
<<<<<<< HEAD
$this->zip->getDirectoryPath("foo")
>>>>>>> Define archive builders and formatters
=======
$this->zip->formatDirectoryPath("foo")
>>>>>>> Finish implementing and testing zip
);
$this->assertEquals(
"/foo/",
<<<<<<< HEAD
<<<<<<< HEAD
$this->zip->formatDirectoryPath("/foo")
=======
$this->zip->getDirectoryPath("/foo")
>>>>>>> Define archive builders and formatters
=======
$this->zip->formatDirectoryPath("/foo")
>>>>>>> Finish implementing and testing zip
);
$this->assertEquals(
"/foo/",
<<<<<<< HEAD
<<<<<<< HEAD
$this->zip->formatDirectoryPath("foo/")
=======
$this->zip->getDirectoryPath("foo/")
>>>>>>> Define archive builders and formatters
=======
$this->zip->formatDirectoryPath("foo/")
>>>>>>> Finish implementing and testing zip
);
$this->assertEquals(
"/foo/",
<<<<<<< HEAD
<<<<<<< HEAD
$this->zip->formatDirectoryPath("/foo/")
=======
$this->zip->getDirectoryPath("/foo/")
>>>>>>> Define archive builders and formatters
=======
$this->zip->formatDirectoryPath("/foo/")
>>>>>>> Finish implementing and testing zip
);
$this->assertEquals(
"/foo/bar/",
<<<<<<< HEAD
<<<<<<< HEAD
$this->zip->formatDirectoryPath("foo/bar")
=======
$this->zip->getDirectoryPath("foo/bar")
>>>>>>> Define archive builders and formatters
=======
$this->zip->formatDirectoryPath("foo/bar")
>>>>>>> Finish implementing and testing zip
);
$this->assertEquals(
"/foo/bar/",
<<<<<<< HEAD
<<<<<<< HEAD
$this->zip->formatDirectoryPath("/foo/bar")
=======
$this->zip->getDirectoryPath("/foo/bar")
>>>>>>> Define archive builders and formatters
=======
$this->zip->formatDirectoryPath("/foo/bar")
>>>>>>> Finish implementing and testing zip
);
$this->assertEquals(
"/foo/bar/",
<<<<<<< HEAD
<<<<<<< HEAD
$this->zip->formatDirectoryPath("/foo//bar/")
=======
$this->zip->getDirectoryPath("/foo//bar/")
>>>>>>> Define archive builders and formatters
=======
$this->zip->formatDirectoryPath("/foo//bar/")
>>>>>>> Finish implementing and testing zip
);
$this->assertEquals(
"/foo/bar/",
<<<<<<< HEAD
<<<<<<< HEAD
$this->zip->formatDirectoryPath("/foo/bar/")
=======
$this->zip->getDirectoryPath("/foo/bar/")
>>>>>>> Define archive builders and formatters
=======
$this->zip->formatDirectoryPath("/foo/bar/")
>>>>>>> Finish implementing and testing zip
);
$this->assertEquals(
"/foo/bar/baz/",
<<<<<<< HEAD
<<<<<<< HEAD
$this->zip->formatDirectoryPath("foo/bar/baz")
=======
$this->zip->getDirectoryPath("foo/bar/baz")
>>>>>>> Define archive builders and formatters
=======
$this->zip->formatDirectoryPath("foo/bar/baz")
>>>>>>> Finish implementing and testing zip
);
$this->assertEquals(
"/foo/bar/baz/",
<<<<<<< HEAD
<<<<<<< HEAD
$this->zip->formatDirectoryPath("//foo/bar///baz/")
=======
$this->zip->getDirectoryPath("//foo/bar///baz/")
>>>>>>> Define archive builders and formatters
=======
$this->zip->formatDirectoryPath("//foo/bar///baz/")
>>>>>>> Finish implementing and testing zip
);
}
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(
@@ -368,30 +169,13 @@ class ZipArchiveBuilderTest extends \PHPUnit_Framework_TestCase
}
/**
<<<<<<< HEAD
<<<<<<< HEAD
* @expectedException \Thelia\Core\FileFormat\Archive\ArchiveBuilder\Exception\ZipArchiveException
=======
* @expectedException \Thelia\Core\FileFormat\Archive\ArchiveBuilder\ZipArchiveException
>>>>>>> Define archive builders and formatters
=======
* @expectedException \Thelia\Core\FileFormat\Archive\ArchiveBuilder\Exception\ZipArchiveException
>>>>>>> Finish implementing and testing zip
* @expectedExceptionMessage [Zip Error] The file is not a zip archive
*/
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
);
}
@@ -401,80 +185,31 @@ 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());
$this->zip->loadArchive(
__DIR__ . DS . "TestResources/well_formatted.zip",
true
=======
$this->zip->loadArchive(
__DIR__ . DS . "TestResources/well_formatted.zip",
"dev",
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
);
}
/**
<<<<<<< HEAD
<<<<<<< HEAD
* @expectedException \Thelia\Core\FileFormat\Archive\ArchiveBuilder\Exception\ZipArchiveException
=======
* @expectedException \Thelia\Core\FileFormat\Archive\ArchiveBuilder\ZipArchiveException
>>>>>>> Define archive builders and formatters
=======
* @expectedException \Thelia\Core\FileFormat\Archive\ArchiveBuilder\Exception\ZipArchiveException
>>>>>>> Finish implementing and testing zip
* @expectedExceptionMessage [Zip Error] The file is not a zip archive
*/
public function testLoadOnlineAvailableAndNotValidFile()
{
<<<<<<< HEAD
<<<<<<< HEAD
$this->zip->setFileDownloader(FakeFileDownloader::getInstance());
$this->zip->loadArchive(
__DIR__ . DS . "TestResources/bad_formatted.zip",
true
=======
$this->zip->loadArchive(
__DIR__ . DS . "TestResources/bad_formatted.zip",
"dev",
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
);
}
@@ -483,27 +218,11 @@ class ZipArchiveBuilderTest extends \PHPUnit_Framework_TestCase
*/
public function testLoadOnlineNotExistingFile()
{
<<<<<<< HEAD
<<<<<<< HEAD
$this->zip->setFileDownloader(FakeFileDownloader::getInstance());
$this->zip->loadArchive(
__DIR__ . DS . "TestResources/this_file_doesn_t_exist.zip",
true
=======
$this->zip->loadArchive(
__DIR__ . DS . "TestResources/this_file_doesn_t_exist.zip",
"dev",
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
);
}
@@ -606,15 +325,7 @@ class ZipArchiveBuilderTest extends \PHPUnit_Framework_TestCase
public function testBuildArchiveResponse()
{
$loadedArchiveResponse = $this->loadedZip
<<<<<<< HEAD
<<<<<<< HEAD
->buildArchiveResponse("test")
=======
->buildArchiveResponse()
>>>>>>> Define archive builders and formatters
=======
->buildArchiveResponse("test")
>>>>>>> Fix Test
;
$loadedArchiveResponseContent = $loadedArchiveResponse->getContent();
@@ -626,10 +337,6 @@ class ZipArchiveBuilderTest extends \PHPUnit_Framework_TestCase
$loadedArchiveResponseContent
);
}
<<<<<<< HEAD
<<<<<<< HEAD
=======
>>>>>>> Finish implementing and testing zip
public function testAddValidFileFromString()
{
@@ -645,10 +352,6 @@ class ZipArchiveBuilderTest extends \PHPUnit_Framework_TestCase
"foo",
$this->loadedZip->getFileContent("bar")
);
<<<<<<< HEAD
<<<<<<< HEAD
=======
>>>>>>> Complete zip tests
$this->loadedZip->addFileFromString(
"foo", "bar", "baz"
@@ -662,11 +365,6 @@ class ZipArchiveBuilderTest extends \PHPUnit_Framework_TestCase
"foo",
$this->loadedZip->getFileContent("baz/bar")
);
<<<<<<< HEAD
=======
>>>>>>> Finish implementing and testing zip
=======
>>>>>>> Complete zip tests
}
/**
@@ -697,15 +395,4 @@ class ZipArchiveBuilderTest extends \PHPUnit_Framework_TestCase
);
}
<<<<<<< HEAD
<<<<<<< HEAD
}
=======
}
>>>>>>> Define archive builders and formatters
=======
}
>>>>>>> Finish implementing and testing zip
=======
}
>>>>>>> Fix cs

View File

@@ -72,12 +72,4 @@ class ArchiveBuilderManagerTest extends \PHPUnit_Framework_TestCase
$this->manager->delete("foo");
}
<<<<<<< HEAD
<<<<<<< HEAD
}
=======
}
>>>>>>> Define archive builders and formatters
=======
}
>>>>>>> Fix cs

View File

@@ -0,0 +1,178 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\FileFormat\Formatting\Formatter;
use Symfony\Component\DependencyInjection\Container;
use Thelia\Core\FileFormat\Formatting\Formatter\XMLFormatter;
use Thelia\Core\FileFormat\Formatting\FormatterData;
use Thelia\Core\Translation\Translator;
/**
* Class XMLFormatterTest
* @package Thelia\Tests\FileFormat\Formatting\Formatter
* @author Benjamin Perche <bperche@openstudio.fr>
*/
class XMLFormatterTest extends \PHPUnit_Framework_TestCase
{
/** @var XMLFormatter */
protected $formatter;
public function setUp()
{
new Translator(new Container());
$this->formatter = new XMLFormatter();
}
public function testMetaData()
{
$this->assertEquals(
"XML",
$this->formatter->getName()
);
$this->assertEquals(
"xml",
$this->formatter->getExtension()
);
$this->assertEquals(
"application/xml",
$this->formatter->getMimeType()
);
}
public function testSimpleEncode()
{
$data = new FormatterData();
$data->setData(
[
"foo" => "bar"
]
);
$dom = new \DOMDocument("1.0");
$dom->appendChild(new \DOMElement("data"))
->appendChild(new \DOMElement("foo", "bar"));
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;
$this->assertEquals(
$dom->saveXML(),
$this->formatter->encode($data)
);
}
public function testComplexEncode()
{
$data = new FormatterData();
$this->formatter->nodeName = "baz";
$data->setData(
[
"foo" => "bar",
[
"name" => "banana",
"type" => "fruit",
],
[
"orange"=>[
"type" => "fruit"
],
"banana"=>[
"like" => "Yes"
]
]
]
);
$dom = new \DOMDocument("1.0");
$base = $dom->appendChild(new \DOMElement("data"));
$base->appendChild(new \DOMElement("foo", "bar"));
$baz = $base->appendChild(new \DOMElement("baz"));
$baz->appendChild(new \DOMElement("name", "banana"));
$baz->appendChild(new \DOMElement("type", "fruit"));
$baz = $base->appendChild(new \DOMElement("baz"));
$orange = $baz->appendChild(new \DOMElement("orange"));
$orange->appendChild(new \DOMElement("type","fruit"));
$banana = $baz->appendChild(new \DOMElement("banana"));
$banana->appendChild(new \DOMElement("like", "Yes"));
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;
$this->assertEquals(
$dom->saveXML(),
$this->formatter->encode($data)
);
}
public function testSimpleDecode()
{
$dom = new \DOMDocument("1.0");
$dom->appendChild(new \DOMElement("data"))
->appendChild(new \DOMElement("foo", "bar"));
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;
$raw = $dom->saveXML();
$data = $this->formatter->decode($raw);
$this->assertEquals(["foo" => "bar"], $data->getData());
}
public function testComplexDecode()
{
$expectedData =
[
"foo" => "bar",
[
"name" => "banana",
"type" => "fruit",
],
[
"orange"=>[
"type" => "fruit"
],
"banana"=>[
"like" => "Yes"
]
]
];
$dom = new \DOMDocument("1.0");
$base = $dom->appendChild(new \DOMElement("data"));
$base->appendChild(new \DOMElement("foo", "bar"));
$baz = $base->appendChild(new \DOMElement("baz"));
$baz->appendChild(new \DOMElement("name", "banana"));
$baz->appendChild(new \DOMElement("type", "fruit"));
$baz = $base->appendChild(new \DOMElement("baz"));
$orange = $baz->appendChild(new \DOMElement("orange"));
$orange->appendChild(new \DOMElement("type","fruit"));
$banana = $baz->appendChild(new \DOMElement("banana"));
$banana->appendChild(new \DOMElement("like", "Yes"));
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;
$this->formatter->nodeName = "baz";
$data = $this->formatter->decode($dom->saveXML());
$this->assertEquals($expectedData, $data->getData());
}
}

View File

@@ -359,8 +359,6 @@ class FormatterDataTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($expectedData,$formattedData);
}
<<<<<<< HEAD
=======
public function testSetRawDataMultipleDepthWithReverseAliases() {
$aliases = [
"orange" => "foo",
@@ -463,5 +461,4 @@ class FormatterDataTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($row, $data->popRow());
$this->assertFalse($data->getRow());
}
>>>>>>> Remove conflicts
}

View File

@@ -22,18 +22,6 @@ use Thelia\Tools\FileDownload\FileDownloader;
class FakeFileDownloader extends FileDownloader
{
/**
<<<<<<< HEAD
<<<<<<< HEAD
* @param string $url
* @param string $pathToStore
=======
* @param string $url
* @param string $pathToStore
>>>>>>> Define archive builders and formatters
=======
* @param string $url
* @param string $pathToStore
>>>>>>> Fix cs
* @throws \Thelia\Exception\FileNotFoundException
* @throws \ErrorException
* @throws \HttpUrlException
@@ -50,13 +38,4 @@ class FakeFileDownloader extends FileDownloader
throw new \ErrorException();
}
}
<<<<<<< HEAD
<<<<<<< HEAD
}
=======
}
>>>>>>> Define archive builders and formatters
=======
}
>>>>>>> Fix cs

View File

@@ -14,15 +14,7 @@ namespace Thelia\Tests\Type;
use Symfony\Component\DependencyInjection\Container;
use Thelia\Core\Translation\Translator;
use Thelia\Log\Tlog;
<<<<<<< HEAD
<<<<<<< HEAD
use Thelia\Tools\FileDownload\FileDownloader;
=======
use Thelia\Tools\FileDownloader;
>>>>>>> Define archive builders and formatters
=======
use Thelia\Tools\FileDownload\FileDownloader;
>>>>>>> Fix FileDownloader test
/**
* Class FileDownloaderTest
@@ -68,12 +60,4 @@ class FileDownloaderTest extends \PHPUnit_Framework_TestCase
{
$this->downloader->download("https://github.com/thelia/thelia", "php://temp");
}
<<<<<<< HEAD
<<<<<<< HEAD
}
=======
}
>>>>>>> Define archive builders and formatters
=======
}
>>>>>>> Fix cs