Merge branch 'master' of https://github.com/thelia/thelia
This commit is contained in:
@@ -65,7 +65,7 @@ class Cart extends BaseAction implements EventSubscriberInterface
|
||||
->filterByProductSaleElementsId($productSaleElementsId)
|
||||
->findOne();
|
||||
|
||||
$this->doAddItem($cart, $productId, $productSaleElementsId, $quantity, $productPrice);
|
||||
$this->doAddItem($cart, $productId, $productPrice->getProductSaleElements(), $quantity, $productPrice);
|
||||
}
|
||||
|
||||
if ($append && $cartItem !== null) {
|
||||
@@ -166,17 +166,18 @@ class Cart extends BaseAction implements EventSubscriberInterface
|
||||
* @param float $quantity
|
||||
* @param ProductPrice $productPrice
|
||||
*/
|
||||
protected function doAddItem(\Thelia\Model\Cart $cart, $productId, $productSaleElementsId, $quantity, ProductPrice $productPrice)
|
||||
protected function doAddItem(\Thelia\Model\Cart $cart, $productId, \Thelia\Model\ProductSaleElements $productSaleElements, $quantity, ProductPrice $productPrice)
|
||||
{
|
||||
$cartItem = new CartItem();
|
||||
$cartItem->setDisptacher($this->getDispatcher());
|
||||
$cartItem
|
||||
->setCart($cart)
|
||||
->setProductId($productId)
|
||||
->setProductSaleElementsId($productSaleElementsId)
|
||||
->setProductSaleElementsId($productSaleElements->getId())
|
||||
->setQuantity($quantity)
|
||||
->setPrice($productPrice->getPrice())
|
||||
->setPromoPrice($productPrice->getPromoPrice())
|
||||
->setPromo($productSaleElements->getPromo())
|
||||
->setPriceEndOfLife(time() + ConfigQuery::read("cart.priceEOF", 60*60*24*30))
|
||||
->save();
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace Thelia\Action;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
@@ -43,6 +44,10 @@ class HttpException extends BaseAction implements EventSubscriberInterface
|
||||
if ($event->getException() instanceof NotFoundHttpException) {
|
||||
$this->display404($event);
|
||||
}
|
||||
|
||||
if($event->getException() instanceof AccessDeniedHttpException) {
|
||||
$this->display403($event);
|
||||
}
|
||||
}
|
||||
|
||||
protected function display404(GetResponseForExceptionEvent $event)
|
||||
|
||||
@@ -99,7 +99,6 @@
|
||||
</route>
|
||||
<route id="cart.add.process" path="/cart/add">
|
||||
<default key="_controller">Thelia\Controller\Front\CartController::addItem</default>
|
||||
<default key="_view">cart</default>
|
||||
</route>
|
||||
|
||||
<route id="cart.delete.process" path="/cart/delete/{cart_item}">
|
||||
|
||||
@@ -69,10 +69,10 @@ class ConstraintValidator
|
||||
/**
|
||||
* Do variable comparison
|
||||
*
|
||||
* @param mixed $v1 Variable 1
|
||||
* @param mixed $v1 Variable 1
|
||||
* @param string $o Operator
|
||||
* @param mixed $v2 Variable 2
|
||||
*
|
||||
* @param mixed $v2 Variable 2
|
||||
* @throws \Exception
|
||||
* @return bool
|
||||
*/
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
namespace Thelia\Constraint\Rule;
|
||||
|
||||
use Symfony\Component\Intl\Exception\NotImplementedException;
|
||||
use Thelia\Constraint\ConstraintValidator;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Coupon\CouponAdapterInterface;
|
||||
use Thelia\Constraint\Validator\ComparableInterface;
|
||||
@@ -73,6 +74,9 @@ abstract class CouponRuleAbstract implements CouponRuleInterface
|
||||
/** @var array Values set by Admin in BackOffice */
|
||||
protected $values = array();
|
||||
|
||||
/** @var ConstraintValidator Constaints validator */
|
||||
protected $constraintValidator = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
||||
@@ -47,6 +47,7 @@ class AddressController extends BaseFrontController
|
||||
*/
|
||||
public function generateModalAction($address_id)
|
||||
{
|
||||
|
||||
$this->checkAuth();
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
@@ -62,6 +63,7 @@ class AddressController extends BaseFrontController
|
||||
*/
|
||||
public function createAction()
|
||||
{
|
||||
|
||||
$this->checkAuth();
|
||||
|
||||
$addressCreate = new AddressCreateForm($this->getRequest());
|
||||
|
||||
@@ -337,6 +337,7 @@ final class TheliaEvents
|
||||
const BEFORE_DELETECURRENCY = "action.before_deleteCurrency";
|
||||
const AFTER_DELETECURRENCY = "action.after_deleteCurrency";
|
||||
|
||||
const CHANGE_DEFAULT_CURRENCY = 'action.changeDefaultCurrency';
|
||||
// -- Product templates management -----------------------------------------
|
||||
|
||||
const TEMPLATE_CREATE = "action.createTemplate";
|
||||
|
||||
@@ -94,7 +94,7 @@ class ViewListener implements EventSubscriberInterface
|
||||
{
|
||||
$request = $this->container->get('request');
|
||||
|
||||
if (!$view = $request->attributes->get('_view')) {
|
||||
if (null === $view = $request->attributes->get('_view')) {
|
||||
$request->attributes->set('_view', $this->findView($request));
|
||||
}
|
||||
|
||||
|
||||
@@ -164,10 +164,12 @@ class Session extends BaseSession
|
||||
$cart = null;
|
||||
if ($cart_id) {
|
||||
$cart = CartQuery::create()->findPk($cart_id);
|
||||
try {
|
||||
$this->verifyValidCart($cart);
|
||||
} catch (InvalidCartException $e) {
|
||||
$cart = null;
|
||||
if($cart) {
|
||||
try {
|
||||
$this->verifyValidCart($cart);
|
||||
} catch (InvalidCartException $e) {
|
||||
$cart = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ abstract class BaseI18nLoop extends BaseLoop
|
||||
$columns,
|
||||
$foreignTable,
|
||||
$foreignKey,
|
||||
$forceReturn
|
||||
$this->getForce_return()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,6 +89,7 @@ abstract class BaseLoop
|
||||
Argument::createIntTypeArgument('page'),
|
||||
Argument::createIntTypeArgument('limit', PHP_INT_MAX),
|
||||
Argument::createBooleanTypeArgument('backend_context', false),
|
||||
Argument::createBooleanTypeArgument('force_return', false),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ use Thelia\Model\Product;
|
||||
use Thelia\Model\ProductQuery;
|
||||
use Thelia\Model\Tools\ModelCriteriaTools;
|
||||
use Thelia\Tools\DateTimeFormat;
|
||||
use Thelia\Cart\CartTrait;
|
||||
|
||||
/**
|
||||
* Implementation of data access to main Thelia objects (users, cart, etc.)
|
||||
@@ -46,6 +47,8 @@ use Thelia\Tools\DateTimeFormat;
|
||||
*/
|
||||
class DataAccessFunctions extends AbstractSmartyPlugin
|
||||
{
|
||||
use CartTrait;
|
||||
|
||||
private $securityContext;
|
||||
protected $parserContext;
|
||||
protected $request;
|
||||
@@ -151,6 +154,20 @@ class DataAccessFunctions extends AbstractSmartyPlugin
|
||||
}
|
||||
}
|
||||
|
||||
public function cartDataAccess($params, $smarty)
|
||||
{
|
||||
$cart = $this->getCart($this->request);
|
||||
$result = "";
|
||||
switch($params["attr"]) {
|
||||
case "count_item":
|
||||
|
||||
$result = $cart->getCartItems()->count();
|
||||
break;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lang global data
|
||||
*
|
||||
@@ -263,6 +280,7 @@ class DataAccessFunctions extends AbstractSmartyPlugin
|
||||
new SmartyPluginDescriptor('function', 'folder', $this, 'folderDataAccess'),
|
||||
new SmartyPluginDescriptor('function', 'currency', $this, 'currencyDataAccess'),
|
||||
new SmartyPluginDescriptor('function', 'lang', $this, 'langDataAccess'),
|
||||
new SmartyPluginDescriptor('function', 'cart', $this, 'cartDataAccess'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\HttpFoundation\Session;
|
||||
|
||||
use Thelia\Core\Event\CurrencyEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Model;
|
||||
|
||||
/**
|
||||
@@ -146,6 +148,9 @@ class TheliaHttpKernel extends HttpKernel
|
||||
$currency = null;
|
||||
if ($request->query->has("currency")) {
|
||||
$currency = Model\CurrencyQuery::create()->findOneByCode($request->query->get("currency"));
|
||||
if($currency) {
|
||||
$this->container->get("event_dispatcher")->dispatch(TheliaEvents::CHANGE_DEFAULT_CURRENCY, new CurrencyEvent($currency));
|
||||
}
|
||||
} else {
|
||||
$currency = $request->getSession()->getCurrency(false);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ use Thelia\Form\Exception\ProductNotFoundException;
|
||||
use Thelia\Model\ProductSaleElementsQuery;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\ProductQuery;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
|
||||
/**
|
||||
* Class CartAdd
|
||||
@@ -75,13 +76,15 @@ class CartAdd extends BaseForm
|
||||
))
|
||||
->add("product_sale_elements_id", "text", array(
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank(),
|
||||
new Constraints\Callback(array("methods" => array(
|
||||
array($this, "checkStockAvailability")
|
||||
)))
|
||||
)
|
||||
),
|
||||
"required" => true
|
||||
|
||||
))
|
||||
->add("quantity", "text", array(
|
||||
->add("quantity", "number", array(
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank(),
|
||||
new Constraints\Callback(array("methods" => array(
|
||||
@@ -90,6 +93,10 @@ class CartAdd extends BaseForm
|
||||
new Constraints\GreaterThanOrEqual(array(
|
||||
"value" => 0
|
||||
))
|
||||
),
|
||||
"label" => Translator::getInstance()->trans("Quantity"),
|
||||
"label_attr" => array(
|
||||
"for" => "quantity"
|
||||
)
|
||||
))
|
||||
->add("append", "hidden")
|
||||
@@ -126,13 +133,17 @@ class CartAdd extends BaseForm
|
||||
{
|
||||
$data = $context->getRoot()->getData();
|
||||
|
||||
$productSaleElements = ProductSaleElementsQuery::create()
|
||||
->filterById($data["product_sale_elements_id"])
|
||||
->filterByProductId($data["product"])
|
||||
->findOne();
|
||||
if (null === $data["product_sale_elements_id"]) {
|
||||
$context->addViolationAt("quantity", Translator::getInstance()->trans("Invalid product_sale_elements"));
|
||||
} else {
|
||||
$productSaleElements = ProductSaleElementsQuery::create()
|
||||
->filterById($data["product_sale_elements_id"])
|
||||
->filterByProductId($data["product"])
|
||||
->findOne();
|
||||
|
||||
if ($productSaleElements->getQuantity() < $value && ConfigQuery::read("verifyStock", 1) == 1) {
|
||||
$context->addViolation("quantity value is not valid");
|
||||
if ($productSaleElements->getQuantity() < $value && ConfigQuery::read("verifyStock", 1) == 1) {
|
||||
$context->addViolation("quantity value is not valid");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,16 +44,18 @@ class Cart extends BaseCart
|
||||
$item->setQuantity($cartItem->getQuantity());
|
||||
$item->setProductSaleElements($productSaleElements);
|
||||
if ($currentDateTime <= $cartItem->getPriceEndOfLife()) {
|
||||
$item->setPrice($cartItem->getPrice());
|
||||
$item->setPromoPrice($cartItem->getPromoPrice());
|
||||
$item->setPrice($cartItem->getPrice())
|
||||
->setPromoPrice($cartItem->getPromoPrice())
|
||||
->setPromo($productSaleElements->getPromo())
|
||||
// TODO : new price EOF or duplicate current priceEOF from $cartItem ?
|
||||
$item->setPriceEndOfLife($cartItem->getPriceEndOfLife());
|
||||
->setPriceEndOfLife($cartItem->getPriceEndOfLife());
|
||||
} else {
|
||||
$productPrices = ProductPriceQuery::create()->filterByProductSaleElements($productSaleElements)->findOne();
|
||||
|
||||
$item->setPrice($productPrices->getPrice());
|
||||
$item->setPromoPrice($productPrices->getPromoPrice());
|
||||
$item->setPriceEndOfLife(time() + ConfigQuery::read("cart.priceEOF", 60*60*24*30));
|
||||
$item->setPrice($productPrices->getPrice())
|
||||
->setPromoPrice($productPrices->getPromoPrice())
|
||||
->setPromo($productSaleElements->getPromo())
|
||||
->setPriceEndOfLife(time() + ConfigQuery::read("cart.priceEOF", 60*60*24*30));
|
||||
}
|
||||
$item->save();
|
||||
}
|
||||
@@ -76,4 +78,17 @@ class Cart extends BaseCart
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function getTotalAmount()
|
||||
{
|
||||
$total = 0;
|
||||
|
||||
foreach($this->getCartItems() as $cartItem) {
|
||||
$total += $cartItem->getPrice()-$cartItem->getDiscount();
|
||||
}
|
||||
|
||||
$total -= $this->getDiscount();
|
||||
|
||||
return $total;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,6 +65,7 @@ class Config extends BaseConfig {
|
||||
*/
|
||||
public function postUpdate(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->resetQueryCache();
|
||||
$this->dispatchEvent(TheliaEvents::AFTER_UPDATECONFIG, new ConfigEvent($this));
|
||||
}
|
||||
|
||||
@@ -83,6 +84,12 @@ class Config extends BaseConfig {
|
||||
*/
|
||||
public function postDelete(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->resetQueryCache();
|
||||
$this->dispatchEvent(TheliaEvents::AFTER_DELETECONFIG, new ConfigEvent($this));
|
||||
}
|
||||
|
||||
public function resetQueryCache()
|
||||
{
|
||||
ConfigQuery::resetCache($this->getName());
|
||||
}
|
||||
}
|
||||
@@ -16,11 +16,32 @@ use Thelia\Model\Base\ConfigQuery as BaseConfigQuery;
|
||||
*
|
||||
*/
|
||||
class ConfigQuery extends BaseConfigQuery {
|
||||
|
||||
protected static $cache = array();
|
||||
|
||||
public static function read($search, $default = null)
|
||||
{
|
||||
if (array_key_exists($search, self::$cache)) {
|
||||
return self::$cache[$search];
|
||||
}
|
||||
|
||||
$value = self::create()->findOneByName($search);
|
||||
|
||||
return $value ? $value->getValue() : $default;
|
||||
self::$cache[$search] = $value ? $value->getValue() : $default;
|
||||
|
||||
return self::$cache[$search];
|
||||
}
|
||||
|
||||
public static function resetCache($key = null)
|
||||
{
|
||||
if($key) {
|
||||
if(array_key_exists($key, self::$cache)) {
|
||||
unset(self::$cache[$key]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
self::$cache = array();
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function getDefaultLangWhenNoTranslationAvailable()
|
||||
|
||||
@@ -65,6 +65,9 @@ class ConstraintValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getCheckoutCurrency')
|
||||
->will($this->returnValue('EUR'));
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getConstraintValidator')
|
||||
->will($this->returnValue($ConstraintValidator));
|
||||
|
||||
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
|
||||
$operators = array(
|
||||
@@ -99,6 +102,9 @@ class ConstraintValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getCheckoutCurrency')
|
||||
->will($this->returnValue('EUR'));
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getConstraintValidator')
|
||||
->will($this->returnValue($ConstraintValidator));
|
||||
|
||||
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
|
||||
$operators = array(
|
||||
@@ -136,6 +142,9 @@ class ConstraintValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(5));
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getConstraintValidator')
|
||||
->will($this->returnValue($ConstraintValidator));
|
||||
|
||||
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
|
||||
$operators = array(
|
||||
@@ -183,6 +192,9 @@ class ConstraintValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(5));
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getConstraintValidator')
|
||||
->will($this->returnValue($ConstraintValidator));
|
||||
|
||||
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
|
||||
$operators = array(
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
namespace Thelia\Coupon;
|
||||
|
||||
use Thelia\Constraint\ConstraintValidator;
|
||||
use Thelia\Constraint\Rule\AvailableForTotalAmountManager;
|
||||
use Thelia\Constraint\Rule\Operators;
|
||||
|
||||
@@ -169,6 +170,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getCheckoutCurrency')
|
||||
->will($this->returnValue('EUR'));
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getConstraintValidator')
|
||||
->will($this->returnValue(new ConstraintValidator()));
|
||||
|
||||
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
|
||||
$operators = array(
|
||||
@@ -205,6 +209,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getCheckoutCurrency')
|
||||
->will($this->returnValue('EUR'));
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getConstraintValidator')
|
||||
->will($this->returnValue(new ConstraintValidator()));
|
||||
|
||||
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
|
||||
$operators = array(
|
||||
@@ -241,6 +248,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getCheckoutCurrency')
|
||||
->will($this->returnValue('EUR'));
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getConstraintValidator')
|
||||
->will($this->returnValue(new ConstraintValidator()));
|
||||
|
||||
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
|
||||
$operators = array(
|
||||
@@ -277,6 +287,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getCheckoutCurrency')
|
||||
->will($this->returnValue('EUR'));
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getConstraintValidator')
|
||||
->will($this->returnValue(new ConstraintValidator()));
|
||||
|
||||
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
|
||||
$operators = array(
|
||||
@@ -313,6 +326,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getCheckoutCurrency')
|
||||
->will($this->returnValue('EUR'));
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getConstraintValidator')
|
||||
->will($this->returnValue(new ConstraintValidator()));
|
||||
|
||||
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
|
||||
$operators = array(
|
||||
@@ -349,6 +365,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getCheckoutCurrency')
|
||||
->will($this->returnValue('EUR'));
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getConstraintValidator')
|
||||
->will($this->returnValue(new ConstraintValidator()));
|
||||
|
||||
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
|
||||
$operators = array(
|
||||
@@ -385,6 +404,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getCheckoutCurrency')
|
||||
->will($this->returnValue('EUR'));
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getConstraintValidator')
|
||||
->will($this->returnValue(new ConstraintValidator()));
|
||||
|
||||
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
|
||||
$operators = array(
|
||||
@@ -421,6 +443,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getCheckoutCurrency')
|
||||
->will($this->returnValue('EUR'));
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getConstraintValidator')
|
||||
->will($this->returnValue(new ConstraintValidator()));
|
||||
|
||||
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
|
||||
$operators = array(
|
||||
@@ -457,6 +482,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getCheckoutCurrency')
|
||||
->will($this->returnValue('EUR'));
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getConstraintValidator')
|
||||
->will($this->returnValue(new ConstraintValidator()));
|
||||
|
||||
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
|
||||
$operators = array(
|
||||
@@ -493,6 +521,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getCheckoutCurrency')
|
||||
->will($this->returnValue('EUR'));
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getConstraintValidator')
|
||||
->will($this->returnValue(new ConstraintValidator()));
|
||||
|
||||
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
|
||||
$operators = array(
|
||||
@@ -529,6 +560,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getCheckoutCurrency')
|
||||
->will($this->returnValue('EUR'));
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getConstraintValidator')
|
||||
->will($this->returnValue(new ConstraintValidator()));
|
||||
|
||||
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
|
||||
$operators = array(
|
||||
@@ -565,6 +599,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getCheckoutCurrency')
|
||||
->will($this->returnValue('EUR'));
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getConstraintValidator')
|
||||
->will($this->returnValue(new ConstraintValidator()));
|
||||
|
||||
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
|
||||
$operators = array(
|
||||
@@ -601,6 +638,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getCheckoutCurrency')
|
||||
->will($this->returnValue('EUR'));
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getConstraintValidator')
|
||||
->will($this->returnValue(new ConstraintValidator()));
|
||||
|
||||
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
|
||||
$operators = array(
|
||||
@@ -637,6 +677,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getCheckoutCurrency')
|
||||
->will($this->returnValue('EUR'));
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getConstraintValidator')
|
||||
->will($this->returnValue(new ConstraintValidator()));
|
||||
|
||||
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
|
||||
$operators = array(
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
namespace Thelia\Coupon;
|
||||
|
||||
use Thelia\Constraint\ConstraintValidator;
|
||||
use Thelia\Constraint\Rule\AvailableForXArticlesManager;
|
||||
use Thelia\Constraint\Rule\Operators;
|
||||
use Thelia\Constraint\Rule\SerializableRule;
|
||||
@@ -192,6 +193,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(4));
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getConstraintValidator')
|
||||
->will($this->returnValue(new ConstraintValidator()));
|
||||
|
||||
$rule1 = new AvailableForXArticlesManager($stubAdapter);
|
||||
$operators = array(
|
||||
@@ -224,6 +228,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(4));
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getConstraintValidator')
|
||||
->will($this->returnValue(new ConstraintValidator()));
|
||||
|
||||
$rule1 = new AvailableForXArticlesManager($stubAdapter);
|
||||
$operators = array(
|
||||
@@ -256,6 +263,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(4));
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getConstraintValidator')
|
||||
->will($this->returnValue(new ConstraintValidator()));
|
||||
|
||||
$rule1 = new AvailableForXArticlesManager($stubAdapter);
|
||||
$operators = array(
|
||||
@@ -288,6 +298,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(4));
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getConstraintValidator')
|
||||
->will($this->returnValue(new ConstraintValidator()));
|
||||
|
||||
$rule1 = new AvailableForXArticlesManager($stubAdapter);
|
||||
$operators = array(
|
||||
@@ -320,6 +333,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(4));
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getConstraintValidator')
|
||||
->will($this->returnValue(new ConstraintValidator()));
|
||||
|
||||
$rule1 = new AvailableForXArticlesManager($stubAdapter);
|
||||
$operators = array(
|
||||
@@ -352,6 +368,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(4));
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getConstraintValidator')
|
||||
->will($this->returnValue(new ConstraintValidator()));
|
||||
|
||||
$rule1 = new AvailableForXArticlesManager($stubAdapter);
|
||||
$operators = array(
|
||||
@@ -384,6 +403,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(4));
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getConstraintValidator')
|
||||
->will($this->returnValue(new ConstraintValidator()));
|
||||
|
||||
$rule1 = new AvailableForXArticlesManager($stubAdapter);
|
||||
$operators = array(
|
||||
@@ -416,6 +438,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(4));
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getConstraintValidator')
|
||||
->will($this->returnValue(new ConstraintValidator()));
|
||||
|
||||
$rule1 = new AvailableForXArticlesManager($stubAdapter);
|
||||
$operators = array(
|
||||
@@ -448,6 +473,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(4));
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getConstraintValidator')
|
||||
->will($this->returnValue(new ConstraintValidator()));
|
||||
|
||||
$rule1 = new AvailableForXArticlesManager($stubAdapter);
|
||||
$operators = array(
|
||||
@@ -480,6 +508,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(4));
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getConstraintValidator')
|
||||
->will($this->returnValue(new ConstraintValidator()));
|
||||
|
||||
$rule1 = new AvailableForXArticlesManager($stubAdapter);
|
||||
$operators = array(
|
||||
@@ -512,6 +543,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(4));
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getConstraintValidator')
|
||||
->will($this->returnValue(new ConstraintValidator()));
|
||||
|
||||
$rule1 = new AvailableForXArticlesManager($stubAdapter);
|
||||
$operators = array(
|
||||
@@ -544,6 +578,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(4));
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getConstraintValidator')
|
||||
->will($this->returnValue(new ConstraintValidator()));
|
||||
|
||||
$rule1 = new AvailableForXArticlesManager($stubAdapter);
|
||||
$operators = array(
|
||||
@@ -570,6 +607,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(4));
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getConstraintValidator')
|
||||
->will($this->returnValue(new ConstraintValidator()));
|
||||
|
||||
$rule1 = new AvailableForXArticlesManager($stubAdapter);
|
||||
$operators = array(
|
||||
@@ -602,6 +642,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(4));
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getConstraintValidator')
|
||||
->will($this->returnValue(new ConstraintValidator()));
|
||||
|
||||
$rule1 = new AvailableForXArticlesManager($stubAdapter);
|
||||
$operators = array(
|
||||
|
||||
Reference in New Issue
Block a user