From 8eaa2de9609798ce7902506470b4c530c07a3ebd Mon Sep 17 00:00:00 2001 From: franck Date: Fri, 9 Aug 2013 10:53:38 +0200 Subject: [PATCH] Fixed cart tests --- core/lib/Thelia/Cart/CartTrait.php | 2 +- core/lib/Thelia/Tests/Action/CartTest.php | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/core/lib/Thelia/Cart/CartTrait.php b/core/lib/Thelia/Cart/CartTrait.php index 90230c474..a5ecd84a9 100644 --- a/core/lib/Thelia/Cart/CartTrait.php +++ b/core/lib/Thelia/Cart/CartTrait.php @@ -118,7 +118,7 @@ trait CartTrait { $session->setCart($newCart->getId()); $cartEvent = new CartEvent($newCart); - $this->dispatcher->dispatch(TheliaEvents::CART_DUPLICATE, $cartEvent); + $this->getDispatcher()->dispatch(TheliaEvents::CART_DUPLICATE, $cartEvent); return $cartEvent->cart; } diff --git a/core/lib/Thelia/Tests/Action/CartTest.php b/core/lib/Thelia/Tests/Action/CartTest.php index c513b2058..665182caa 100644 --- a/core/lib/Thelia/Tests/Action/CartTest.php +++ b/core/lib/Thelia/Tests/Action/CartTest.php @@ -43,6 +43,12 @@ class CartTest extends \PHPUnit_Framework_TestCase protected $uniqid; + public function getContainer() + { + $container = new \Symfony\Component\DependencyInjection\ContainerBuilder(); + + return $container; + } public function setUp() { @@ -55,10 +61,14 @@ class CartTest extends \PHPUnit_Framework_TestCase $dispatcher = $this->getMock("Symfony\Component\EventDispatcher\EventDispatcherInterface"); + $container = $this->getContainer(); + + $container->set("event_dispatcher", $dispatcher); + $this->actionCart = $this->getMock( "\Thelia\Action\Cart", array("generateCookie", "redirect"), - array($dispatcher) + array($container) );