From 79120528b504790974ee64bac6ccb03bd19a367b Mon Sep 17 00:00:00 2001 From: Etienne Roudeix Date: Thu, 14 Nov 2013 14:17:47 +0100 Subject: [PATCH] fix unit tests search by id in loop bug due to not visible first entry in database --- core/lib/Thelia/Tests/Action/OrderTest.php | 5 +++++ core/lib/Thelia/Tests/Core/Template/Loop/CategoryTest.php | 6 +++++- core/lib/Thelia/Tests/Core/Template/Loop/ContentTest.php | 6 +++++- core/lib/Thelia/Tests/Core/Template/Loop/FolderTest.php | 6 +++++- core/lib/Thelia/Tests/Core/Template/Loop/ProductTest.php | 6 +++++- 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/core/lib/Thelia/Tests/Action/OrderTest.php b/core/lib/Thelia/Tests/Action/OrderTest.php index 7d0918650..64a92fd40 100644 --- a/core/lib/Thelia/Tests/Action/OrderTest.php +++ b/core/lib/Thelia/Tests/Action/OrderTest.php @@ -24,6 +24,7 @@ namespace Thelia\Tests\Action; use Propel\Runtime\ActiveQuery\Criteria; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; use Thelia\Core\Event\Order\OrderAddressEvent; use Thelia\Core\Event\Order\OrderEvent; @@ -250,6 +251,10 @@ class OrderTest extends \PHPUnit_Framework_TestCase throw new \Exception('No Payment Module fixture found'); } + /* define payment module in container */ + $paymentModuleClass = $paymentModule->getFullNamespace(); + $this->container->set(sprintf('module.%s', $paymentModule->getCode()), new $paymentModuleClass()); + $this->orderEvent->getOrder()->chosenDeliveryAddress = $validDeliveryAddress->getId(); $this->orderEvent->getOrder()->chosenInvoiceAddress = $validInvoiceAddress->getId(); $this->orderEvent->getOrder()->setDeliveryModuleId($deliveryModule->getId()); diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/CategoryTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/CategoryTest.php index c3fbe56d9..c4bf8f3a6 100755 --- a/core/lib/Thelia/Tests/Core/Template/Loop/CategoryTest.php +++ b/core/lib/Thelia/Tests/Core/Template/Loop/CategoryTest.php @@ -61,7 +61,11 @@ class CategoryTest extends BaseLoopTestor $category->save(); } - $this->baseTestSearchById($category->getId()); + $otherParameters = array( + "visible" => "*", + ); + + $this->baseTestSearchById($category->getId(), $otherParameters); } public function testSearchLimit() diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/ContentTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/ContentTest.php index dbb705b03..3d5329a66 100755 --- a/core/lib/Thelia/Tests/Core/Template/Loop/ContentTest.php +++ b/core/lib/Thelia/Tests/Core/Template/Loop/ContentTest.php @@ -61,7 +61,11 @@ class ContentTest extends BaseLoopTestor $content->save(); } - $this->baseTestSearchById($content->getId()); + $otherParameters = array( + "visible" => "*", + ); + + $this->baseTestSearchById($content->getId(), $otherParameters); } public function testSearchLimit() diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/FolderTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/FolderTest.php index a5210839e..87c078e16 100755 --- a/core/lib/Thelia/Tests/Core/Template/Loop/FolderTest.php +++ b/core/lib/Thelia/Tests/Core/Template/Loop/FolderTest.php @@ -61,7 +61,11 @@ class FolderTest extends BaseLoopTestor $folder->save(); } - $this->baseTestSearchById($folder->getId()); + $otherParameters = array( + "visible" => "*", + ); + + $this->baseTestSearchById($folder->getId(), $otherParameters); } public function testSearchLimit() diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/ProductTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/ProductTest.php index e806a6971..66081caa5 100755 --- a/core/lib/Thelia/Tests/Core/Template/Loop/ProductTest.php +++ b/core/lib/Thelia/Tests/Core/Template/Loop/ProductTest.php @@ -62,7 +62,11 @@ class ProductTest extends BaseLoopTestor $product->save(); } - $this->baseTestSearchById($product->getId()); + $otherParameters = array( + "visible" => "*", + ); + + $this->baseTestSearchById($product->getId(), $otherParameters); } public function testSearchLimit()