Fixed cart tests

This commit is contained in:
franck
2013-08-09 10:53:38 +02:00
parent 00100945f6
commit 8eaa2de960
2 changed files with 12 additions and 2 deletions

View File

@@ -118,7 +118,7 @@ trait CartTrait {
$session->setCart($newCart->getId()); $session->setCart($newCart->getId());
$cartEvent = new CartEvent($newCart); $cartEvent = new CartEvent($newCart);
$this->dispatcher->dispatch(TheliaEvents::CART_DUPLICATE, $cartEvent); $this->getDispatcher()->dispatch(TheliaEvents::CART_DUPLICATE, $cartEvent);
return $cartEvent->cart; return $cartEvent->cart;
} }

View File

@@ -43,6 +43,12 @@ class CartTest extends \PHPUnit_Framework_TestCase
protected $uniqid; protected $uniqid;
public function getContainer()
{
$container = new \Symfony\Component\DependencyInjection\ContainerBuilder();
return $container;
}
public function setUp() public function setUp()
{ {
@@ -55,10 +61,14 @@ class CartTest extends \PHPUnit_Framework_TestCase
$dispatcher = $this->getMock("Symfony\Component\EventDispatcher\EventDispatcherInterface"); $dispatcher = $this->getMock("Symfony\Component\EventDispatcher\EventDispatcherInterface");
$container = $this->getContainer();
$container->set("event_dispatcher", $dispatcher);
$this->actionCart = $this->getMock( $this->actionCart = $this->getMock(
"\Thelia\Action\Cart", "\Thelia\Action\Cart",
array("generateCookie", "redirect"), array("generateCookie", "redirect"),
array($dispatcher) array($container)
); );