Fixed cart tests
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user