From 606ad49316c54199024d31b80eb6b73cc7661640 Mon Sep 17 00:00:00 2001 From: Benjamin Perche Date: Tue, 5 Aug 2014 15:32:51 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20tests=20=09modifi=C3=A9:=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20core/lib/Thelia/Tests/FileFormat/Archive/ArchiveBui?= =?UTF-8?q?lderManagerTest.php=20=09modifi=C3=A9:=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20core/lib/Thelia/Tests/ImportExport/Export/ProductPricesExpor?= =?UTF-8?q?tTest.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Archive/ArchiveBuilderManagerTest.php | 58 ++++++++++++++++++- .../Export/ProductPricesExportTest.php | 4 +- 2 files changed, 59 insertions(+), 3 deletions(-) diff --git a/core/lib/Thelia/Tests/FileFormat/Archive/ArchiveBuilderManagerTest.php b/core/lib/Thelia/Tests/FileFormat/Archive/ArchiveBuilderManagerTest.php index 69fdfdb9a..3cdb600d5 100644 --- a/core/lib/Thelia/Tests/FileFormat/Archive/ArchiveBuilderManagerTest.php +++ b/core/lib/Thelia/Tests/FileFormat/Archive/ArchiveBuilderManagerTest.php @@ -39,7 +39,34 @@ class ArchiveBuilderManagerTest extends \PHPUnit_Framework_TestCase public function testAddArchiveBuilder() { /** @var AbstractArchiveBuilder $instance */ - $instance = $this->getMock("Thelia\\Core\\FileFormat\\Archive\\AbstractArchiveBuilder"); + $instance = $this->getMock( + "Thelia\\Core\\FileFormat\\Archive\\AbstractArchiveBuilder", + [ + "isAvailable", + "getName", + "getExtension", + "getMimeType", + "addFile", + "addFileFromString", + "getFileContent", + "deleteFile", + "addDirectory", + "buildArchiveResponse", + "loadArchive", + "hasFile", + "hasDirectory", + ] + ); + + $instance->expects($this->any()) + ->method("isAvailable") + ->willReturn(true) + ; + + $instance->expects($this->any()) + ->method("getName") + ->willReturn("foo") + ; $this->manager->add($instance); @@ -53,7 +80,34 @@ class ArchiveBuilderManagerTest extends \PHPUnit_Framework_TestCase public function testDeleteArchiveBuilder() { /** @var AbstractArchiveBuilder $instance */ - $instance = $this->getMock("Thelia\\Core\\FileFormat\\Archive\\AbstractArchiveBuilder"); + $instance = $this->getMock( + "Thelia\\Core\\FileFormat\\Archive\\AbstractArchiveBuilder", + [ + "isAvailable", + "getName", + "getExtension", + "getMimeType", + "addFile", + "addFileFromString", + "getFileContent", + "deleteFile", + "addDirectory", + "buildArchiveResponse", + "loadArchive", + "hasFile", + "hasDirectory", + ] + ); + + $instance->expects($this->any()) + ->method("isAvailable") + ->willReturn(true) + ; + + $instance->expects($this->any()) + ->method("getName") + ->willReturn("foo") + ; $this->manager->add($instance); diff --git a/core/lib/Thelia/Tests/ImportExport/Export/ProductPricesExportTest.php b/core/lib/Thelia/Tests/ImportExport/Export/ProductPricesExportTest.php index 689dbcee8..1fa104a75 100644 --- a/core/lib/Thelia/Tests/ImportExport/Export/ProductPricesExportTest.php +++ b/core/lib/Thelia/Tests/ImportExport/Export/ProductPricesExportTest.php @@ -74,7 +74,9 @@ class ProductPricesExportTest extends \PHPUnit_Framework_TestCase $attributes = []; foreach ($attributeCombinations as $attributeCombination) { - $attributes[] = $attributeCombination->getAttributeAv()->getTitle(); + if (!in_array($attributeCombination->getAttributeAv()->getTitle(), $attributes)) { + $attributes[] = $attributeCombination->getAttributeAv()->getTitle(); + } } $rowAttributes = explode(",", $row["attributes"]);