Working : Refactor adapter into facade
This commit is contained in:
@@ -24,7 +24,7 @@
|
|||||||
namespace Thelia\Condition;
|
namespace Thelia\Condition;
|
||||||
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
use Thelia\Coupon\AdapterInterface;
|
use Thelia\Coupon\FacadeInterface;
|
||||||
use Thelia\Coupon\ConditionCollection;
|
use Thelia\Coupon\ConditionCollection;
|
||||||
|
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ class ConditionFactory
|
|||||||
/** @var ContainerInterface Service Container */
|
/** @var ContainerInterface Service Container */
|
||||||
protected $container = null;
|
protected $container = null;
|
||||||
|
|
||||||
/** @var AdapterInterface Provide necessary value from Thelia */
|
/** @var FacadeInterface Provide necessary value from Thelia */
|
||||||
protected $adapter;
|
protected $adapter;
|
||||||
|
|
||||||
/** @var array ConditionCollection to process*/
|
/** @var array ConditionCollection to process*/
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace Thelia\Condition;
|
|||||||
|
|
||||||
use Symfony\Component\Intl\Exception\NotImplementedException;
|
use Symfony\Component\Intl\Exception\NotImplementedException;
|
||||||
use Thelia\Core\Translation\Translator;
|
use Thelia\Core\Translation\Translator;
|
||||||
use Thelia\Coupon\AdapterInterface;
|
use Thelia\Coupon\FacadeInterface;
|
||||||
use Thelia\Exception\InvalidConditionValueException;
|
use Thelia\Exception\InvalidConditionValueException;
|
||||||
use Thelia\Model\Currency;
|
use Thelia\Model\Currency;
|
||||||
use Thelia\Type\FloatType;
|
use Thelia\Type\FloatType;
|
||||||
@@ -60,7 +60,7 @@ abstract class ConditionManagerAbstract implements ConditionManagerInterface
|
|||||||
// /** @var array Parameters to be validated */
|
// /** @var array Parameters to be validated */
|
||||||
// protected $paramsToValidate = array();
|
// protected $paramsToValidate = array();
|
||||||
|
|
||||||
/** @var AdapterInterface Provide necessary value from Thelia */
|
/** @var FacadeInterface Provide necessary value from Thelia */
|
||||||
protected $adapter = null;
|
protected $adapter = null;
|
||||||
|
|
||||||
/** @var Translator Service Translator */
|
/** @var Translator Service Translator */
|
||||||
@@ -78,9 +78,9 @@ abstract class ConditionManagerAbstract implements ConditionManagerInterface
|
|||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param AdapterInterface $adapter Service adapter
|
* @param FacadeInterface $adapter Service adapter
|
||||||
*/
|
*/
|
||||||
public function __construct(AdapterInterface $adapter)
|
public function __construct(FacadeInterface $adapter)
|
||||||
{
|
{
|
||||||
$this->adapter = $adapter;
|
$this->adapter = $adapter;
|
||||||
$this->translator = $adapter->getTranslator();
|
$this->translator = $adapter->getTranslator();
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
namespace Thelia\Condition;
|
namespace Thelia\Condition;
|
||||||
|
|
||||||
use Thelia\Core\Translation\Translator;
|
use Thelia\Core\Translation\Translator;
|
||||||
use Thelia\Coupon\AdapterInterface;
|
use Thelia\Coupon\FacadeInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by JetBrains PhpStorm.
|
* Created by JetBrains PhpStorm.
|
||||||
@@ -42,9 +42,9 @@ interface ConditionManagerInterface
|
|||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param AdapterInterface $adapter Service adapter
|
* @param FacadeInterface $adapter Service adapter
|
||||||
*/
|
*/
|
||||||
function __construct(AdapterInterface $adapter);
|
function __construct(FacadeInterface $adapter);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Rule Service id
|
* Get Rule Service id
|
||||||
|
|||||||
@@ -276,7 +276,7 @@
|
|||||||
<service id="kernel" synthetic="true" />
|
<service id="kernel" synthetic="true" />
|
||||||
|
|
||||||
<!-- Coupon module -->
|
<!-- Coupon module -->
|
||||||
<service id="thelia.adapter" class="Thelia\Coupon\BaseAdapter">
|
<service id="thelia.adapter" class="Thelia\Coupon\BaseFacade">
|
||||||
<argument type="service" id="service_container" />
|
<argument type="service" id="service_container" />
|
||||||
</service>
|
</service>
|
||||||
<service id="thelia.coupon.manager" class="Thelia\Coupon\CouponManager">
|
<service id="thelia.coupon.manager" class="Thelia\Coupon\CouponManager">
|
||||||
|
|||||||
@@ -609,7 +609,7 @@ class CouponController extends BaseAdminController
|
|||||||
// */
|
// */
|
||||||
// protected function validateConditionsCreation($type, $operator, $values)
|
// protected function validateConditionsCreation($type, $operator, $values)
|
||||||
// {
|
// {
|
||||||
// /** @var AdapterInterface $adapter */
|
// /** @var FacadeInterface $adapter */
|
||||||
// $adapter = $this->container->get('thelia.adapter');
|
// $adapter = $this->container->get('thelia.adapter');
|
||||||
// $validator = new PriceParam()
|
// $validator = new PriceParam()
|
||||||
// try {
|
// try {
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ use Symfony\Component\DependencyInjection\Container;
|
|||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
use Symfony\Component\Translation\Translator;
|
use Symfony\Component\Translation\Translator;
|
||||||
use Symfony\Component\Translation\TranslatorInterface;
|
use Symfony\Component\Translation\TranslatorInterface;
|
||||||
|
use Thelia\Condition\ConditionEvaluator;
|
||||||
use Thelia\Core\HttpFoundation\Request;
|
use Thelia\Core\HttpFoundation\Request;
|
||||||
use Thelia\Coupon\Type\CouponInterface;
|
use Thelia\Coupon\Type\CouponInterface;
|
||||||
use Thelia\Model\Coupon;
|
use Thelia\Model\Coupon;
|
||||||
@@ -47,7 +48,7 @@ use Thelia\Model\CurrencyQuery;
|
|||||||
* @todo implements
|
* @todo implements
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class BaseAdapter implements AdapterInterface
|
class BaseFacade implements FacadeInterface
|
||||||
{
|
{
|
||||||
use CartTrait {
|
use CartTrait {
|
||||||
CartTrait::getCart as getCartFromTrait;
|
CartTrait::getCart as getCartFromTrait;
|
||||||
@@ -261,7 +262,7 @@ class BaseAdapter implements AdapterInterface
|
|||||||
/**
|
/**
|
||||||
* Return Constraint Validator
|
* Return Constraint Validator
|
||||||
*
|
*
|
||||||
* @return ConditionValidator
|
* @return ConditionEvaluator
|
||||||
*/
|
*/
|
||||||
public function getConditionEvaluator()
|
public function getConditionEvaluator()
|
||||||
{
|
{
|
||||||
@@ -47,7 +47,7 @@ class CouponFactory
|
|||||||
/** @var ContainerInterface Service Container */
|
/** @var ContainerInterface Service Container */
|
||||||
protected $container = null;
|
protected $container = null;
|
||||||
|
|
||||||
/** @var AdapterInterface Provide necessary value from Thelia*/
|
/** @var FacadeInterface Provide necessary value from Thelia*/
|
||||||
protected $adapter;
|
protected $adapter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ use Thelia\Coupon\Type\CouponInterface;
|
|||||||
*/
|
*/
|
||||||
class CouponManager
|
class CouponManager
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface Provides necessary value from Thelia */
|
/** @var FacadeInterface Provides necessary value from Thelia */
|
||||||
protected $adapter = null;
|
protected $adapter = null;
|
||||||
|
|
||||||
/** @var ContainerInterface Service Container */
|
/** @var ContainerInterface Service Container */
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ use Thelia\Model\Coupon;
|
|||||||
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
interface AdapterInterface
|
interface FacadeInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -26,7 +26,7 @@ namespace Thelia\Coupon\Type;
|
|||||||
use Symfony\Component\Intl\Exception\NotImplementedException;
|
use Symfony\Component\Intl\Exception\NotImplementedException;
|
||||||
use Thelia\Condition\ConditionEvaluator;
|
use Thelia\Condition\ConditionEvaluator;
|
||||||
use Thelia\Core\Translation\Translator;
|
use Thelia\Core\Translation\Translator;
|
||||||
use Thelia\Coupon\AdapterInterface;
|
use Thelia\Coupon\FacadeInterface;
|
||||||
use Thelia\Coupon\ConditionCollection;
|
use Thelia\Coupon\ConditionCollection;
|
||||||
use Thelia\Coupon\RuleOrganizerInterface;
|
use Thelia\Coupon\RuleOrganizerInterface;
|
||||||
use Thelia\Exception\InvalidConditionException;
|
use Thelia\Exception\InvalidConditionException;
|
||||||
@@ -44,7 +44,7 @@ use Thelia\Exception\InvalidConditionException;
|
|||||||
*/
|
*/
|
||||||
abstract class CouponAbstract implements CouponInterface
|
abstract class CouponAbstract implements CouponInterface
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface Provide necessary value from Thelia */
|
/** @var FacadeInterface Provide necessary value from Thelia */
|
||||||
protected $adapter = null;
|
protected $adapter = null;
|
||||||
|
|
||||||
/** @var Translator Service Translator */
|
/** @var Translator Service Translator */
|
||||||
@@ -104,9 +104,9 @@ abstract class CouponAbstract implements CouponInterface
|
|||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param AdapterInterface $adapter Service adapter
|
* @param FacadeInterface $adapter Service adapter
|
||||||
*/
|
*/
|
||||||
public function __construct(AdapterInterface $adapter)
|
public function __construct(FacadeInterface $adapter)
|
||||||
{
|
{
|
||||||
$this->adapter = $adapter;
|
$this->adapter = $adapter;
|
||||||
$this->translator = $adapter->getTranslator();
|
$this->translator = $adapter->getTranslator();
|
||||||
@@ -298,7 +298,7 @@ abstract class CouponAbstract implements CouponInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the current state of the application is matching this Coupon conditions
|
* Check if the current state of the application is matching this Coupon conditions
|
||||||
* Thelia variables are given by the AdapterInterface
|
* Thelia variables are given by the FacadeInterface
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
namespace Thelia\Coupon\Type;
|
namespace Thelia\Coupon\Type;
|
||||||
|
|
||||||
use Thelia\Coupon\AdapterInterface;
|
use Thelia\Coupon\FacadeInterface;
|
||||||
use Thelia\Coupon\ConditionCollection;
|
use Thelia\Coupon\ConditionCollection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -209,7 +209,7 @@ interface CouponInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the current Coupon is matching its conditions (Rules)
|
* Check if the current Coupon is matching its conditions (Rules)
|
||||||
* Thelia variables are given by the AdapterInterface
|
* Thelia variables are given by the FacadeInterface
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace Thelia\Condition\Implementation;
|
|||||||
|
|
||||||
use Thelia\Condition\ConditionEvaluator;
|
use Thelia\Condition\ConditionEvaluator;
|
||||||
use Thelia\Condition\Operators;
|
use Thelia\Condition\Operators;
|
||||||
use Thelia\Coupon\AdapterInterface;
|
use Thelia\Coupon\FacadeInterface;
|
||||||
use Thelia\Coupon\ConditionCollection;
|
use Thelia\Coupon\ConditionCollection;
|
||||||
use Thelia\Model\CurrencyQuery;
|
use Thelia\Model\CurrencyQuery;
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ class ConditionEvaluatorTest extends \PHPUnit_Framework_TestCase
|
|||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
@@ -131,7 +131,7 @@ class ConditionEvaluatorTest extends \PHPUnit_Framework_TestCase
|
|||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
@@ -205,7 +205,7 @@ class ConditionEvaluatorTest extends \PHPUnit_Framework_TestCase
|
|||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
@@ -292,7 +292,7 @@ class ConditionEvaluatorTest extends \PHPUnit_Framework_TestCase
|
|||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace Thelia\Condition\Implementation;
|
|||||||
use Thelia\Condition\ConditionEvaluator;
|
use Thelia\Condition\ConditionEvaluator;
|
||||||
use Thelia\Condition\ConditionFactory;
|
use Thelia\Condition\ConditionFactory;
|
||||||
use Thelia\Condition\Operators;
|
use Thelia\Condition\Operators;
|
||||||
use Thelia\Coupon\AdapterInterface;
|
use Thelia\Coupon\FacadeInterface;
|
||||||
use Thelia\Coupon\ConditionCollection;
|
use Thelia\Coupon\ConditionCollection;
|
||||||
use Thelia\Model\CurrencyQuery;
|
use Thelia\Model\CurrencyQuery;
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
|
|||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
@@ -125,7 +125,7 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
|
|||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
@@ -187,7 +187,7 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
|
|||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
@@ -266,7 +266,7 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
|
|||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
@@ -331,7 +331,7 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
|
|||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace Thelia\Condition\Implementation;
|
|||||||
|
|
||||||
use Thelia\Condition\ConditionEvaluator;
|
use Thelia\Condition\ConditionEvaluator;
|
||||||
use Thelia\Condition\Operators;
|
use Thelia\Condition\Operators;
|
||||||
use Thelia\Coupon\AdapterInterface;
|
use Thelia\Coupon\FacadeInterface;
|
||||||
use Thelia\Model\Currency;
|
use Thelia\Model\Currency;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,7 +41,7 @@ use Thelia\Model\Currency;
|
|||||||
*/
|
*/
|
||||||
class MatchForEveryoneManagerTest extends \PHPUnit_Framework_TestCase
|
class MatchForEveryoneManagerTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface $stubTheliaAdapter */
|
/** @var FacadeInterface $stubTheliaAdapter */
|
||||||
protected $stubTheliaAdapter = null;
|
protected $stubTheliaAdapter = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -91,7 +91,7 @@ class MatchForEveryoneManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
||||||
|
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$condition1 = new MatchForEveryoneManager($stubAdapter);
|
$condition1 = new MatchForEveryoneManager($stubAdapter);
|
||||||
$operators = array();
|
$operators = array();
|
||||||
$values = array();
|
$values = array();
|
||||||
@@ -114,7 +114,7 @@ class MatchForEveryoneManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
||||||
|
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$condition1 = new MatchForEveryoneManager($stubAdapter);
|
$condition1 = new MatchForEveryoneManager($stubAdapter);
|
||||||
|
|
||||||
$isValid = $condition1->isMatching();
|
$isValid = $condition1->isMatching();
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace Thelia\Condition\Implementation;
|
|||||||
|
|
||||||
use Thelia\Condition\ConditionEvaluator;
|
use Thelia\Condition\ConditionEvaluator;
|
||||||
use Thelia\Condition\Operators;
|
use Thelia\Condition\Operators;
|
||||||
use Thelia\Coupon\AdapterInterface;
|
use Thelia\Coupon\FacadeInterface;
|
||||||
use Thelia\Exception\InvalidConditionValueException;
|
use Thelia\Exception\InvalidConditionValueException;
|
||||||
use Thelia\Model\Currency;
|
use Thelia\Model\Currency;
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ use Thelia\Model\Currency;
|
|||||||
*/
|
*/
|
||||||
class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface $stubTheliaAdapter */
|
/** @var FacadeInterface $stubTheliaAdapter */
|
||||||
protected $stubTheliaAdapter = null;
|
protected $stubTheliaAdapter = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -102,7 +102,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
||||||
|
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||||
$operators = array(
|
$operators = array(
|
||||||
MatchForTotalAmountManager::INPUT1 => Operators::IN,
|
MatchForTotalAmountManager::INPUT1 => Operators::IN,
|
||||||
@@ -131,7 +131,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
||||||
|
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||||
$operators = array(
|
$operators = array(
|
||||||
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR,
|
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR,
|
||||||
@@ -158,7 +158,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testInValidBackOfficeInputValue()
|
public function testInValidBackOfficeInputValue()
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
||||||
|
|
||||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||||
@@ -187,7 +187,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testInValidBackOfficeInputValue2()
|
public function testInValidBackOfficeInputValue2()
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
||||||
|
|
||||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||||
@@ -215,7 +215,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testMatchingConditionInferior()
|
public function testMatchingConditionInferior()
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
||||||
|
|
||||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||||
@@ -243,7 +243,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testNotMatchingConditionInferior()
|
public function testNotMatchingConditionInferior()
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->generateAdapterStub(400, 'EUR');
|
$stubAdapter = $this->generateAdapterStub(400, 'EUR');
|
||||||
|
|
||||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||||
@@ -271,7 +271,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testMatchingConditionInferiorEquals()
|
public function testMatchingConditionInferiorEquals()
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->generateAdapterStub(400, 'EUR');
|
$stubAdapter = $this->generateAdapterStub(400, 'EUR');
|
||||||
|
|
||||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||||
@@ -299,7 +299,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testMatchingConditionInferiorEquals2()
|
public function testMatchingConditionInferiorEquals2()
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
||||||
|
|
||||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||||
@@ -327,7 +327,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testNotMatchingConditionInferiorEquals()
|
public function testNotMatchingConditionInferiorEquals()
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->generateAdapterStub(401, 'EUR');
|
$stubAdapter = $this->generateAdapterStub(401, 'EUR');
|
||||||
|
|
||||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||||
@@ -355,7 +355,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testMatchingConditionEqual()
|
public function testMatchingConditionEqual()
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->generateAdapterStub(400, 'EUR');
|
$stubAdapter = $this->generateAdapterStub(400, 'EUR');
|
||||||
|
|
||||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||||
@@ -383,7 +383,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testNotMatchingConditionEqual()
|
public function testNotMatchingConditionEqual()
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
||||||
|
|
||||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||||
@@ -411,7 +411,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testMatchingConditionSuperiorEquals()
|
public function testMatchingConditionSuperiorEquals()
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->generateAdapterStub(401, 'EUR');
|
$stubAdapter = $this->generateAdapterStub(401, 'EUR');
|
||||||
|
|
||||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||||
@@ -439,7 +439,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testMatchingConditionSuperiorEquals2()
|
public function testMatchingConditionSuperiorEquals2()
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->generateAdapterStub(400, 'EUR');
|
$stubAdapter = $this->generateAdapterStub(400, 'EUR');
|
||||||
|
|
||||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||||
@@ -467,7 +467,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testNotMatchingConditionSuperiorEquals()
|
public function testNotMatchingConditionSuperiorEquals()
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
||||||
|
|
||||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||||
@@ -495,7 +495,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testMatchingConditionSuperior()
|
public function testMatchingConditionSuperior()
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->generateAdapterStub(401, 'EUR');
|
$stubAdapter = $this->generateAdapterStub(401, 'EUR');
|
||||||
|
|
||||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||||
@@ -523,7 +523,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testNotMatchingConditionSuperior()
|
public function testNotMatchingConditionSuperior()
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
||||||
|
|
||||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||||
@@ -551,7 +551,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testMatchingConditionCurrency()
|
public function testMatchingConditionCurrency()
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->generateAdapterStub(400, 'EUR');
|
$stubAdapter = $this->generateAdapterStub(400, 'EUR');
|
||||||
|
|
||||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||||
@@ -579,7 +579,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testNotMatchingConditionCurrency()
|
public function testNotMatchingConditionCurrency()
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->generateAdapterStub(400.00, 'EUR');
|
$stubAdapter = $this->generateAdapterStub(400.00, 'EUR');
|
||||||
|
|
||||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace Thelia\Condition\Implementation;
|
|||||||
use Thelia\Condition\ConditionEvaluator;
|
use Thelia\Condition\ConditionEvaluator;
|
||||||
use Thelia\Condition\Operators;
|
use Thelia\Condition\Operators;
|
||||||
use Thelia\Condition\SerializableCondition;
|
use Thelia\Condition\SerializableCondition;
|
||||||
use Thelia\Coupon\AdapterInterface;
|
use Thelia\Coupon\FacadeInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by JetBrains PhpStorm.
|
* Created by JetBrains PhpStorm.
|
||||||
@@ -59,12 +59,12 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testInValidBackOfficeInputOperator()
|
public function testInValidBackOfficeInputOperator()
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter->expects($this->any())
|
$stubAdapter->expects($this->any())
|
||||||
->method('getNbArticlesInCart')
|
->method('getNbArticlesInCart')
|
||||||
->will($this->returnValue(4));
|
->will($this->returnValue(4));
|
||||||
@@ -96,7 +96,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testInValidBackOfficeInputValue()
|
public function testInValidBackOfficeInputValue()
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
@@ -132,7 +132,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testMatchingRuleInferior()
|
public function testMatchingRuleInferior()
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
@@ -168,7 +168,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testNotMatchingRuleInferior()
|
public function testNotMatchingRuleInferior()
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
@@ -204,7 +204,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testMatchingRuleInferiorEquals()
|
public function testMatchingRuleInferiorEquals()
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
@@ -240,7 +240,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testMatchingRuleInferiorEquals2()
|
public function testMatchingRuleInferiorEquals2()
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
@@ -276,7 +276,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testNotMatchingRuleInferiorEquals()
|
public function testNotMatchingRuleInferiorEquals()
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
@@ -312,7 +312,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testMatchingRuleEqual()
|
public function testMatchingRuleEqual()
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
@@ -348,7 +348,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testNotMatchingRuleEqual()
|
public function testNotMatchingRuleEqual()
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
@@ -384,7 +384,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testMatchingRuleSuperiorEquals()
|
public function testMatchingRuleSuperiorEquals()
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
@@ -420,7 +420,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testMatchingRuleSuperiorEquals2()
|
public function testMatchingRuleSuperiorEquals2()
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
@@ -456,7 +456,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testNotMatchingRuleSuperiorEquals()
|
public function testNotMatchingRuleSuperiorEquals()
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
@@ -492,7 +492,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testMatchingRuleSuperior()
|
public function testMatchingRuleSuperior()
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
@@ -528,7 +528,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testNotMatchingRuleSuperior()
|
public function testNotMatchingRuleSuperior()
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
@@ -558,7 +558,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testGetSerializableRule()
|
public function testGetSerializableRule()
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
@@ -594,7 +594,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testGetAvailableOperators()
|
public function testGetAvailableOperators()
|
||||||
{
|
{
|
||||||
/** @var AdapterInterface $stubAdapter */
|
/** @var FacadeInterface $stubAdapter */
|
||||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
@@ -632,7 +632,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
// public function testGetValidators()
|
// public function testGetValidators()
|
||||||
// {
|
// {
|
||||||
// $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
// $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
|
||||||
// ->disableOriginalConstructor()
|
// ->disableOriginalConstructor()
|
||||||
// ->getMock();
|
// ->getMock();
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace Thelia\Coupon;
|
|||||||
* Date: 8/19/13
|
* Date: 8/19/13
|
||||||
* Time: 3:24 PM
|
* Time: 3:24 PM
|
||||||
*
|
*
|
||||||
* Unit Test BaseAdapter Class
|
* Unit Test BaseFacade Class
|
||||||
*
|
*
|
||||||
* @package Coupon
|
* @package Coupon
|
||||||
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
||||||
@@ -44,7 +44,7 @@ class CouponBaseAdapterTest extends \PHPUnit_Framework_TestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
// /**
|
// /**
|
||||||
// * @var BaseAdapter
|
// * @var BaseFacade
|
||||||
// */
|
// */
|
||||||
// protected $object;
|
// protected $object;
|
||||||
//
|
//
|
||||||
@@ -54,7 +54,7 @@ class CouponBaseAdapterTest extends \PHPUnit_Framework_TestCase
|
|||||||
// */
|
// */
|
||||||
// protected function setUp()
|
// protected function setUp()
|
||||||
// {
|
// {
|
||||||
// $this->object = new BaseAdapter;
|
// $this->object = new BaseFacade;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// /**
|
// /**
|
||||||
@@ -66,7 +66,7 @@ class CouponBaseAdapterTest extends \PHPUnit_Framework_TestCase
|
|||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// /**
|
// /**
|
||||||
// * @covers Thelia\Coupon\BaseAdapter::getCart
|
// * @covers Thelia\Coupon\BaseFacade::getCart
|
||||||
// * @todo Implement testGetCart().
|
// * @todo Implement testGetCart().
|
||||||
// */
|
// */
|
||||||
// public function testGetCart()
|
// public function testGetCart()
|
||||||
@@ -78,7 +78,7 @@ class CouponBaseAdapterTest extends \PHPUnit_Framework_TestCase
|
|||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// /**
|
// /**
|
||||||
// * @covers Thelia\Coupon\BaseAdapter::getDeliveryAddress
|
// * @covers Thelia\Coupon\BaseFacade::getDeliveryAddress
|
||||||
// * @todo Implement testGetDeliveryAddress().
|
// * @todo Implement testGetDeliveryAddress().
|
||||||
// */
|
// */
|
||||||
// public function testGetDeliveryAddress()
|
// public function testGetDeliveryAddress()
|
||||||
@@ -90,7 +90,7 @@ class CouponBaseAdapterTest extends \PHPUnit_Framework_TestCase
|
|||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// /**
|
// /**
|
||||||
// * @covers Thelia\Coupon\BaseAdapter::getCustomer
|
// * @covers Thelia\Coupon\BaseFacade::getCustomer
|
||||||
// * @todo Implement testGetCustomer().
|
// * @todo Implement testGetCustomer().
|
||||||
// */
|
// */
|
||||||
// public function testGetCustomer()
|
// public function testGetCustomer()
|
||||||
|
|||||||
@@ -23,14 +23,6 @@
|
|||||||
|
|
||||||
namespace Thelia\Coupon;
|
namespace Thelia\Coupon;
|
||||||
|
|
||||||
use Thelia\Constraint\Validator\PriceParam;
|
|
||||||
use Thelia\Constraint\Validator\RuleValidator;
|
|
||||||
use Thelia\Constraint\Rule\AvailableForTotalAmount;
|
|
||||||
use Thelia\Constraint\Rule\Operators;
|
|
||||||
use Thelia\Coupon\Type\CouponInterface;
|
|
||||||
use Thelia\Exception\CouponExpiredException;
|
|
||||||
use Thelia\Model\Coupon;
|
|
||||||
|
|
||||||
require_once 'CouponManagerTest.php';
|
require_once 'CouponManagerTest.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -109,9 +101,9 @@ class CouponFactoryTest extends \PHPUnit_Framework_TestCase
|
|||||||
// $isRemovingPostage
|
// $isRemovingPostage
|
||||||
// );
|
// );
|
||||||
//
|
//
|
||||||
// /** @var AdapterInterface $stubCouponBaseAdapter */
|
// /** @var FacadeInterface $stubCouponBaseAdapter */
|
||||||
// $stubCouponBaseAdapter = $this->getMock(
|
// $stubCouponBaseAdapter = $this->getMock(
|
||||||
// 'Thelia\Coupon\BaseAdapter',
|
// 'Thelia\Coupon\BaseFacade',
|
||||||
// array('findOneCouponByCode'),
|
// array('findOneCouponByCode'),
|
||||||
// array()
|
// array()
|
||||||
// );
|
// );
|
||||||
@@ -135,7 +127,7 @@ class CouponFactoryTest extends \PHPUnit_Framework_TestCase
|
|||||||
// $date = new \DateTime();
|
// $date = new \DateTime();
|
||||||
// $date->setTimestamp(strtotime("today - 2 months"));
|
// $date->setTimestamp(strtotime("today - 2 months"));
|
||||||
//
|
//
|
||||||
// /** @var AdapterInterface $mockAdapter */
|
// /** @var FacadeInterface $mockAdapter */
|
||||||
// $mockAdapter = $this->generateCouponModelMock(null, null, null, null, null, null, null, null, $date);
|
// $mockAdapter = $this->generateCouponModelMock(null, null, null, null, null, null, null, null, $date);
|
||||||
// $couponFactory = new CouponFactory($mockAdapter);
|
// $couponFactory = new CouponFactory($mockAdapter);
|
||||||
// $coupon = $couponFactory->buildCouponFromCode('XMAS1');
|
// $coupon = $couponFactory->buildCouponFromCode('XMAS1');
|
||||||
@@ -151,7 +143,7 @@ class CouponFactoryTest extends \PHPUnit_Framework_TestCase
|
|||||||
// {
|
// {
|
||||||
// $date = new \DateTime();
|
// $date = new \DateTime();
|
||||||
//
|
//
|
||||||
// /** @var AdapterInterface $mockAdapter */
|
// /** @var FacadeInterface $mockAdapter */
|
||||||
// $mockAdapter = $this->generateCouponModelMock(null, null, null, null, null, null, null, null, $date);
|
// $mockAdapter = $this->generateCouponModelMock(null, null, null, null, null, null, null, null, $date);
|
||||||
// $couponFactory = new CouponFactory($mockAdapter);
|
// $couponFactory = new CouponFactory($mockAdapter);
|
||||||
// $coupon = $couponFactory->buildCouponFromCode('XMAS1');
|
// $coupon = $couponFactory->buildCouponFromCode('XMAS1');
|
||||||
@@ -165,7 +157,7 @@ class CouponFactoryTest extends \PHPUnit_Framework_TestCase
|
|||||||
// */
|
// */
|
||||||
// public function testBuildCouponFromCodeWithoutRule()
|
// public function testBuildCouponFromCodeWithoutRule()
|
||||||
// {
|
// {
|
||||||
// /** @var AdapterInterface $mockAdapter */
|
// /** @var FacadeInterface $mockAdapter */
|
||||||
// $mockAdapter = $this->generateCouponModelMock(null, null, null, null, null, null, null, null, null, new ConditionCollection(array()));
|
// $mockAdapter = $this->generateCouponModelMock(null, null, null, null, null, null, null, null, null, new ConditionCollection(array()));
|
||||||
// $couponFactory = new CouponFactory($mockAdapter);
|
// $couponFactory = new CouponFactory($mockAdapter);
|
||||||
// $coupon = $couponFactory->buildCouponFromCode('XMAS1');
|
// $coupon = $couponFactory->buildCouponFromCode('XMAS1');
|
||||||
@@ -178,7 +170,7 @@ class CouponFactoryTest extends \PHPUnit_Framework_TestCase
|
|||||||
// */
|
// */
|
||||||
// public function testBuildCouponFromCode()
|
// public function testBuildCouponFromCode()
|
||||||
// {
|
// {
|
||||||
// /** @var AdapterInterface $mockAdapter */
|
// /** @var FacadeInterface $mockAdapter */
|
||||||
// $mockAdapter = $this->generateCouponModelMock();
|
// $mockAdapter = $this->generateCouponModelMock();
|
||||||
// $couponFactory = new CouponFactory($mockAdapter);
|
// $couponFactory = new CouponFactory($mockAdapter);
|
||||||
// /** @var CouponInterface $coupon */
|
// /** @var CouponInterface $coupon */
|
||||||
|
|||||||
@@ -23,11 +23,6 @@
|
|||||||
|
|
||||||
namespace Thelia\Coupon;
|
namespace Thelia\Coupon;
|
||||||
|
|
||||||
use Thelia\Constraint\Validator\PriceParam;
|
|
||||||
use Thelia\Constraint\Validator\RuleValidator;
|
|
||||||
use Thelia\Constraint\Rule\Operators;
|
|
||||||
use Thelia\Coupon\Type\CouponInterface;
|
|
||||||
use Thelia\Tools\PhpUnitUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by JetBrains PhpStorm.
|
* Created by JetBrains PhpStorm.
|
||||||
@@ -88,7 +83,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
// /** @var CouponInterface $coupon */
|
// /** @var CouponInterface $coupon */
|
||||||
// $coupon = self::generateValidCoupon();
|
// $coupon = self::generateValidCoupon();
|
||||||
//
|
//
|
||||||
// /** @var AdapterInterface $stubCouponBaseAdapter */
|
// /** @var FacadeInterface $stubCouponBaseAdapter */
|
||||||
// $stubCouponBaseAdapter = $this->generateFakeAdapter(array($coupon), $cartTotalPrice, $checkoutTotalPrice);
|
// $stubCouponBaseAdapter = $this->generateFakeAdapter(array($coupon), $cartTotalPrice, $checkoutTotalPrice);
|
||||||
//
|
//
|
||||||
// $couponManager = new CouponManager($stubCouponBaseAdapter);
|
// $couponManager = new CouponManager($stubCouponBaseAdapter);
|
||||||
@@ -108,7 +103,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
// */
|
// */
|
||||||
// public function testGetDiscountTwoCoupon()
|
// public function testGetDiscountTwoCoupon()
|
||||||
// {
|
// {
|
||||||
// $adapter = new BaseAdapter();
|
// $adapter = new BaseFacade();
|
||||||
// $cartTotalPrice = 100.00;
|
// $cartTotalPrice = 100.00;
|
||||||
// $checkoutTotalPrice = 120.00;
|
// $checkoutTotalPrice = 120.00;
|
||||||
//
|
//
|
||||||
@@ -128,7 +123,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
// /** @var CouponInterface $coupon2 */
|
// /** @var CouponInterface $coupon2 */
|
||||||
// $coupon2 = $this->generateValidCoupon('XMAS2', null, null, null, 15.00, null, null, $rules);
|
// $coupon2 = $this->generateValidCoupon('XMAS2', null, null, null, 15.00, null, null, $rules);
|
||||||
//
|
//
|
||||||
// /** @var AdapterInterface $stubCouponBaseAdapter */
|
// /** @var FacadeInterface $stubCouponBaseAdapter */
|
||||||
// $stubCouponBaseAdapter = $this->generateFakeAdapter(array($coupon1, $coupon2), $cartTotalPrice, $checkoutTotalPrice);
|
// $stubCouponBaseAdapter = $this->generateFakeAdapter(array($coupon1, $coupon2), $cartTotalPrice, $checkoutTotalPrice);
|
||||||
//
|
//
|
||||||
// $couponManager = new CouponManager($stubCouponBaseAdapter);
|
// $couponManager = new CouponManager($stubCouponBaseAdapter);
|
||||||
@@ -148,7 +143,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
// */
|
// */
|
||||||
// public function testGetDiscountAlwaysInferiorToPrice()
|
// public function testGetDiscountAlwaysInferiorToPrice()
|
||||||
// {
|
// {
|
||||||
// $adapter = new BaseAdapter();
|
// $adapter = new BaseFacade();
|
||||||
// $cartTotalPrice = 21.00;
|
// $cartTotalPrice = 21.00;
|
||||||
// $checkoutTotalPrice = 26.00;
|
// $checkoutTotalPrice = 26.00;
|
||||||
//
|
//
|
||||||
@@ -166,7 +161,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
// /** @var CouponInterface $coupon */
|
// /** @var CouponInterface $coupon */
|
||||||
// $coupon = $this->generateValidCoupon('XMAS2', null, null, null, 30.00, null, null, $rules);
|
// $coupon = $this->generateValidCoupon('XMAS2', null, null, null, 30.00, null, null, $rules);
|
||||||
//
|
//
|
||||||
// /** @var AdapterInterface $stubCouponBaseAdapter */
|
// /** @var FacadeInterface $stubCouponBaseAdapter */
|
||||||
// $stubCouponBaseAdapter = $this->generateFakeAdapter(array($coupon), $cartTotalPrice, $checkoutTotalPrice);
|
// $stubCouponBaseAdapter = $this->generateFakeAdapter(array($coupon), $cartTotalPrice, $checkoutTotalPrice);
|
||||||
//
|
//
|
||||||
// $couponManager = new CouponManager($stubCouponBaseAdapter);
|
// $couponManager = new CouponManager($stubCouponBaseAdapter);
|
||||||
@@ -185,7 +180,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
// */
|
// */
|
||||||
// public function testIsCouponRemovingPostage()
|
// public function testIsCouponRemovingPostage()
|
||||||
// {
|
// {
|
||||||
// $adapter = new BaseAdapter();
|
// $adapter = new BaseFacade();
|
||||||
// $cartTotalPrice = 21.00;
|
// $cartTotalPrice = 21.00;
|
||||||
// $checkoutTotalPrice = 27.00;
|
// $checkoutTotalPrice = 27.00;
|
||||||
//
|
//
|
||||||
@@ -203,7 +198,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
// /** @var CouponInterface $coupon */
|
// /** @var CouponInterface $coupon */
|
||||||
// $coupon = $this->generateValidCoupon('XMAS2', null, null, null, 30.00, null, null, $rules, null, true);
|
// $coupon = $this->generateValidCoupon('XMAS2', null, null, null, 30.00, null, null, $rules, null, true);
|
||||||
//
|
//
|
||||||
// /** @var AdapterInterface $stubCouponBaseAdapter */
|
// /** @var FacadeInterface $stubCouponBaseAdapter */
|
||||||
// $stubCouponBaseAdapter = $this->generateFakeAdapter(array($coupon), $cartTotalPrice, $checkoutTotalPrice);
|
// $stubCouponBaseAdapter = $this->generateFakeAdapter(array($coupon), $cartTotalPrice, $checkoutTotalPrice);
|
||||||
//
|
//
|
||||||
// $couponManager = new CouponManager($stubCouponBaseAdapter);
|
// $couponManager = new CouponManager($stubCouponBaseAdapter);
|
||||||
@@ -231,7 +226,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
//
|
//
|
||||||
// $coupons = array($couponCumulative1);
|
// $coupons = array($couponCumulative1);
|
||||||
//
|
//
|
||||||
// /** @var AdapterInterface $stubCouponBaseAdapter */
|
// /** @var FacadeInterface $stubCouponBaseAdapter */
|
||||||
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
||||||
//
|
//
|
||||||
// // When
|
// // When
|
||||||
@@ -264,7 +259,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
// $couponCumulative1 = $this->generateValidCoupon(null, null, null, null, null, null, null, null, true);
|
// $couponCumulative1 = $this->generateValidCoupon(null, null, null, null, null, null, null, null, true);
|
||||||
//
|
//
|
||||||
// $coupons = array($couponCumulative1);
|
// $coupons = array($couponCumulative1);
|
||||||
// /** @var AdapterInterface $stubCouponBaseAdapter */
|
// /** @var FacadeInterface $stubCouponBaseAdapter */
|
||||||
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
||||||
//
|
//
|
||||||
// // When
|
// // When
|
||||||
@@ -299,7 +294,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
// $couponCumulative2 = $this->generateValidCoupon('XMAS2', null, null, null, null, null, null, null, true);
|
// $couponCumulative2 = $this->generateValidCoupon('XMAS2', null, null, null, null, null, null, null, true);
|
||||||
//
|
//
|
||||||
// $coupons = array($couponCumulative1, $couponCumulative2);
|
// $coupons = array($couponCumulative1, $couponCumulative2);
|
||||||
// /** @var AdapterInterface $stubCouponBaseAdapter */
|
// /** @var FacadeInterface $stubCouponBaseAdapter */
|
||||||
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
||||||
//
|
//
|
||||||
// // When
|
// // When
|
||||||
@@ -334,7 +329,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
// $couponCumulative2 = $this->generateValidCoupon('XMAS2', null, null, null, null, null, null, null, false);
|
// $couponCumulative2 = $this->generateValidCoupon('XMAS2', null, null, null, null, null, null, null, false);
|
||||||
//
|
//
|
||||||
// $coupons = array($couponCumulative1, $couponCumulative2);
|
// $coupons = array($couponCumulative1, $couponCumulative2);
|
||||||
// /** @var AdapterInterface $stubCouponBaseAdapter */
|
// /** @var FacadeInterface $stubCouponBaseAdapter */
|
||||||
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
||||||
//
|
//
|
||||||
// // When
|
// // When
|
||||||
@@ -369,7 +364,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
// $couponCumulative2 = $this->generateValidCoupon('XMAS2', null, null, null, null, null, null, null, true);
|
// $couponCumulative2 = $this->generateValidCoupon('XMAS2', null, null, null, null, null, null, null, true);
|
||||||
//
|
//
|
||||||
// $coupons = array($couponCumulative1, $couponCumulative2);
|
// $coupons = array($couponCumulative1, $couponCumulative2);
|
||||||
// /** @var AdapterInterface $stubCouponBaseAdapter */
|
// /** @var FacadeInterface $stubCouponBaseAdapter */
|
||||||
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
||||||
//
|
//
|
||||||
// // When
|
// // When
|
||||||
@@ -404,7 +399,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
// $couponCumulative2 = $this->generateValidCoupon('XMAS2', null, null, null, null, null, null, null, false);
|
// $couponCumulative2 = $this->generateValidCoupon('XMAS2', null, null, null, null, null, null, null, false);
|
||||||
//
|
//
|
||||||
// $coupons = array($couponCumulative1, $couponCumulative2);
|
// $coupons = array($couponCumulative1, $couponCumulative2);
|
||||||
// /** @var AdapterInterface $stubCouponBaseAdapter */
|
// /** @var FacadeInterface $stubCouponBaseAdapter */
|
||||||
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
||||||
//
|
//
|
||||||
// // When
|
// // When
|
||||||
@@ -437,7 +432,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
// $couponCumulative1 = $this->generateValidCoupon('XMAS1', null, null, null, null, null, new \DateTime(), null, true);
|
// $couponCumulative1 = $this->generateValidCoupon('XMAS1', null, null, null, null, null, new \DateTime(), null, true);
|
||||||
//
|
//
|
||||||
// $coupons = array($couponCumulative1);
|
// $coupons = array($couponCumulative1);
|
||||||
// /** @var AdapterInterface $stubCouponBaseAdapter */
|
// /** @var FacadeInterface $stubCouponBaseAdapter */
|
||||||
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
||||||
//
|
//
|
||||||
// // When
|
// // When
|
||||||
@@ -472,7 +467,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
// $couponCumulative2 = $this->generateValidCoupon('XMAS2', null, null, null, null, null, new \DateTime(), null, true);
|
// $couponCumulative2 = $this->generateValidCoupon('XMAS2', null, null, null, null, null, new \DateTime(), null, true);
|
||||||
//
|
//
|
||||||
// $coupons = array($couponCumulative1, $couponCumulative2);
|
// $coupons = array($couponCumulative1, $couponCumulative2);
|
||||||
// /** @var AdapterInterface $stubCouponBaseAdapter */
|
// /** @var FacadeInterface $stubCouponBaseAdapter */
|
||||||
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
||||||
//
|
//
|
||||||
// // When
|
// // When
|
||||||
@@ -507,7 +502,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
// $couponCumulative2 = $this->generateValidCoupon('XMAS2', null, null, null, null, null, null, null, true);
|
// $couponCumulative2 = $this->generateValidCoupon('XMAS2', null, null, null, null, null, null, null, true);
|
||||||
//
|
//
|
||||||
// $coupons = array($couponCumulative1, $couponCumulative2);
|
// $coupons = array($couponCumulative1, $couponCumulative2);
|
||||||
// /** @var AdapterInterface $stubCouponBaseAdapter */
|
// /** @var FacadeInterface $stubCouponBaseAdapter */
|
||||||
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
||||||
//
|
//
|
||||||
// // When
|
// // When
|
||||||
@@ -542,7 +537,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
// $couponCumulative2 = $this->generateValidCoupon('XMAS2', null, null, null, null, null, new \DateTime(), null, true);
|
// $couponCumulative2 = $this->generateValidCoupon('XMAS2', null, null, null, null, null, new \DateTime(), null, true);
|
||||||
//
|
//
|
||||||
// $coupons = array($couponCumulative1, $couponCumulative2);
|
// $coupons = array($couponCumulative1, $couponCumulative2);
|
||||||
// /** @var AdapterInterface $stubCouponBaseAdapter */
|
// /** @var FacadeInterface $stubCouponBaseAdapter */
|
||||||
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
||||||
//
|
//
|
||||||
// // When
|
// // When
|
||||||
@@ -581,7 +576,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
// $couponCumulative4 = $this->generateValidCoupon('XMAS4', null, null, null, null, null, null, null, true);
|
// $couponCumulative4 = $this->generateValidCoupon('XMAS4', null, null, null, null, null, null, null, true);
|
||||||
//
|
//
|
||||||
// $coupons = array($couponCumulative1, $couponCumulative2, $couponCumulative3, $couponCumulative4);
|
// $coupons = array($couponCumulative1, $couponCumulative2, $couponCumulative3, $couponCumulative4);
|
||||||
// /** @var AdapterInterface $stubCouponBaseAdapter */
|
// /** @var FacadeInterface $stubCouponBaseAdapter */
|
||||||
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
||||||
//
|
//
|
||||||
// // When
|
// // When
|
||||||
@@ -620,7 +615,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
// $couponCumulative4 = $this->generateValidCoupon('XMAS4', null, null, null, null, null, null, null, false);
|
// $couponCumulative4 = $this->generateValidCoupon('XMAS4', null, null, null, null, null, null, null, false);
|
||||||
//
|
//
|
||||||
// $coupons = array($couponCumulative1, $couponCumulative2, $couponCumulative3, $couponCumulative4);
|
// $coupons = array($couponCumulative1, $couponCumulative2, $couponCumulative3, $couponCumulative4);
|
||||||
// /** @var AdapterInterface $stubCouponBaseAdapter */
|
// /** @var FacadeInterface $stubCouponBaseAdapter */
|
||||||
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
||||||
//
|
//
|
||||||
// // When
|
// // When
|
||||||
@@ -645,7 +640,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
// */
|
// */
|
||||||
// public static function generateValidRules()
|
// public static function generateValidRules()
|
||||||
// {
|
// {
|
||||||
// $adapter = new BaseAdapter();
|
// $adapter = new BaseFacade();
|
||||||
// $rule1 = new AvailableForTotalAmount(
|
// $rule1 = new AvailableForTotalAmount(
|
||||||
// $adapter, array(
|
// $adapter, array(
|
||||||
// AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator(
|
// AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator(
|
||||||
@@ -692,7 +687,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
// public function generateFakeAdapter(array $coupons, $cartTotalPrice, $checkoutTotalPrice, $postagePrice = 6.00)
|
// public function generateFakeAdapter(array $coupons, $cartTotalPrice, $checkoutTotalPrice, $postagePrice = 6.00)
|
||||||
// {
|
// {
|
||||||
// $stubCouponBaseAdapter = $this->getMock(
|
// $stubCouponBaseAdapter = $this->getMock(
|
||||||
// 'Thelia\Coupon\BaseAdapter',
|
// 'Thelia\Coupon\BaseFacade',
|
||||||
// array(
|
// array(
|
||||||
// 'getCurrentCoupons',
|
// 'getCurrentCoupons',
|
||||||
// 'getCartTotalPrice',
|
// 'getCartTotalPrice',
|
||||||
@@ -758,7 +753,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
// $isAvailableOnSpecialOffers = null,
|
// $isAvailableOnSpecialOffers = null,
|
||||||
// $maxUsage = null
|
// $maxUsage = null
|
||||||
// ) {
|
// ) {
|
||||||
// $adapter = new BaseAdapter();
|
// $adapter = new BaseFacade();
|
||||||
// if ($code === null) {
|
// if ($code === null) {
|
||||||
// $code = self::VALID_CODE;
|
// $code = self::VALID_CODE;
|
||||||
// }
|
// }
|
||||||
|
|||||||
@@ -23,10 +23,6 @@
|
|||||||
|
|
||||||
namespace Thelia\Coupon;
|
namespace Thelia\Coupon;
|
||||||
|
|
||||||
use Thelia\Constraint\Validator\PriceParam;
|
|
||||||
use Thelia\Constraint\Validator\RuleValidator;
|
|
||||||
use Thelia\Constraint\Rule\Operators;
|
|
||||||
use Thelia\Coupon\Type\RemoveXAmountManager;
|
|
||||||
|
|
||||||
//require_once '../CouponManagerTest.php';
|
//require_once '../CouponManagerTest.php';
|
||||||
|
|
||||||
@@ -153,7 +149,7 @@ class RemoveXAmountTest extends \PHPUnit_Framework_TestCase
|
|||||||
// */
|
// */
|
||||||
// public function testGetEffect()
|
// public function testGetEffect()
|
||||||
// {
|
// {
|
||||||
// $adapter = new BaseAdapter();
|
// $adapter = new BaseFacade();
|
||||||
// $coupon = CouponManagerTest::generateValidCoupon(null, null, null, null, null, null, null, null, false, false);
|
// $coupon = CouponManagerTest::generateValidCoupon(null, null, null, null, null, null, null, null, false, false);
|
||||||
//
|
//
|
||||||
// $expected = 10;
|
// $expected = 10;
|
||||||
@@ -228,7 +224,7 @@ class RemoveXAmountTest extends \PHPUnit_Framework_TestCase
|
|||||||
// public function testGetEffectIfTotalAmountInferiorTo400Valid()
|
// public function testGetEffectIfTotalAmountInferiorTo400Valid()
|
||||||
// {
|
// {
|
||||||
// // Given
|
// // Given
|
||||||
// $adapter = new BaseAdapter();
|
// $adapter = new BaseFacade();
|
||||||
// $rule0 = $this->generateValidRuleAvailableForTotalAmountOperatorTo(
|
// $rule0 = $this->generateValidRuleAvailableForTotalAmountOperatorTo(
|
||||||
// Operators::INFERIOR,
|
// Operators::INFERIOR,
|
||||||
// 400.00
|
// 400.00
|
||||||
@@ -253,7 +249,7 @@ class RemoveXAmountTest extends \PHPUnit_Framework_TestCase
|
|||||||
// public function testGetEffectIfTotalAmountInferiorOrEqualTo400Valid()
|
// public function testGetEffectIfTotalAmountInferiorOrEqualTo400Valid()
|
||||||
// {
|
// {
|
||||||
// // Given
|
// // Given
|
||||||
// $adapter = new BaseAdapter();
|
// $adapter = new BaseFacade();
|
||||||
// $rule0 = $this->generateValidRuleAvailableForTotalAmountOperatorTo(
|
// $rule0 = $this->generateValidRuleAvailableForTotalAmountOperatorTo(
|
||||||
// Operators::INFERIOR_OR_EQUAL,
|
// Operators::INFERIOR_OR_EQUAL,
|
||||||
// 400.00
|
// 400.00
|
||||||
@@ -278,7 +274,7 @@ class RemoveXAmountTest extends \PHPUnit_Framework_TestCase
|
|||||||
// public function testGetEffectIfTotalAmountEqualTo400Valid()
|
// public function testGetEffectIfTotalAmountEqualTo400Valid()
|
||||||
// {
|
// {
|
||||||
// // Given
|
// // Given
|
||||||
// $adapter = new BaseAdapter();
|
// $adapter = new BaseFacade();
|
||||||
// $rule0 = $this->generateValidRuleAvailableForTotalAmountOperatorTo(
|
// $rule0 = $this->generateValidRuleAvailableForTotalAmountOperatorTo(
|
||||||
// Operators::EQUAL,
|
// Operators::EQUAL,
|
||||||
// 400.00
|
// 400.00
|
||||||
@@ -303,7 +299,7 @@ class RemoveXAmountTest extends \PHPUnit_Framework_TestCase
|
|||||||
// public function testGetEffectIfTotalAmountSuperiorOrEqualTo400Valid()
|
// public function testGetEffectIfTotalAmountSuperiorOrEqualTo400Valid()
|
||||||
// {
|
// {
|
||||||
// // Given
|
// // Given
|
||||||
// $adapter = new BaseAdapter();
|
// $adapter = new BaseFacade();
|
||||||
// $rule0 = $this->generateValidRuleAvailableForTotalAmountOperatorTo(
|
// $rule0 = $this->generateValidRuleAvailableForTotalAmountOperatorTo(
|
||||||
// Operators::SUPERIOR_OR_EQUAL,
|
// Operators::SUPERIOR_OR_EQUAL,
|
||||||
// 400.00
|
// 400.00
|
||||||
@@ -328,7 +324,7 @@ class RemoveXAmountTest extends \PHPUnit_Framework_TestCase
|
|||||||
// public function testGetEffectIfTotalAmountSuperiorTo400Valid()
|
// public function testGetEffectIfTotalAmountSuperiorTo400Valid()
|
||||||
// {
|
// {
|
||||||
// // Given
|
// // Given
|
||||||
// $adapter = new BaseAdapter();
|
// $adapter = new BaseFacade();
|
||||||
// $rule0 = $this->generateValidRuleAvailableForTotalAmountOperatorTo(
|
// $rule0 = $this->generateValidRuleAvailableForTotalAmountOperatorTo(
|
||||||
// Operators::SUPERIOR,
|
// Operators::SUPERIOR,
|
||||||
// 400.00
|
// 400.00
|
||||||
@@ -365,7 +361,7 @@ class RemoveXAmountTest extends \PHPUnit_Framework_TestCase
|
|||||||
// */
|
// */
|
||||||
// protected function generateValidRuleAvailableForTotalAmountOperatorTo($operator, $amount)
|
// protected function generateValidRuleAvailableForTotalAmountOperatorTo($operator, $amount)
|
||||||
// {
|
// {
|
||||||
// $adapter = new BaseAdapter();
|
// $adapter = new BaseFacade();
|
||||||
// $validators = array(
|
// $validators = array(
|
||||||
// AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator(
|
// AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator(
|
||||||
// $operator,
|
// $operator,
|
||||||
|
|||||||
@@ -24,11 +24,6 @@
|
|||||||
namespace Thelia\Coupon;
|
namespace Thelia\Coupon;
|
||||||
|
|
||||||
use PHPUnit_Framework_TestCase;
|
use PHPUnit_Framework_TestCase;
|
||||||
use Thelia\Constraint\Rule\Operators;
|
|
||||||
use Thelia\Constraint\Validator\PriceParam;
|
|
||||||
use Thelia\Constraint\Validator\RuleValidator;
|
|
||||||
use Thelia\Coupon\Type\CouponInterface;
|
|
||||||
use Thelia\Coupon\Type\RemoveXPercentManager;
|
|
||||||
|
|
||||||
//require_once '../CouponManagerTest.php';
|
//require_once '../CouponManagerTest.php';
|
||||||
|
|
||||||
@@ -407,7 +402,7 @@ class RemoveXPercentTest extends \PHPUnit_Framework_TestCase
|
|||||||
// */
|
// */
|
||||||
// protected function generateValidRuleAvailableForTotalAmountOperatorTo($operator, $amount)
|
// protected function generateValidRuleAvailableForTotalAmountOperatorTo($operator, $amount)
|
||||||
// {
|
// {
|
||||||
// $adapter = new BaseAdapter();
|
// $adapter = new BaseFacade();
|
||||||
// $validators = array(
|
// $validators = array(
|
||||||
// AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator(
|
// AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator(
|
||||||
// $operator,
|
// $operator,
|
||||||
@@ -432,7 +427,7 @@ class RemoveXPercentTest extends \PHPUnit_Framework_TestCase
|
|||||||
// public function generateFakeAdapter($cartTotalPrice)
|
// public function generateFakeAdapter($cartTotalPrice)
|
||||||
// {
|
// {
|
||||||
// $stubCouponBaseAdapter = $this->getMock(
|
// $stubCouponBaseAdapter = $this->getMock(
|
||||||
// 'Thelia\Coupon\BaseAdapter',
|
// 'Thelia\Coupon\BaseFacade',
|
||||||
// array(
|
// array(
|
||||||
// 'getCartTotalPrice'
|
// 'getCartTotalPrice'
|
||||||
// ),
|
// ),
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use Thelia\Condition\Implementation\MatchForEveryoneManager;
|
|||||||
use Thelia\Condition\Implementation\MatchForTotalAmountManager;
|
use Thelia\Condition\Implementation\MatchForTotalAmountManager;
|
||||||
use Thelia\Condition\Implementation\MatchForXArticlesManager;
|
use Thelia\Condition\Implementation\MatchForXArticlesManager;
|
||||||
use Thelia\Condition\Operators;
|
use Thelia\Condition\Operators;
|
||||||
use Thelia\Coupon\AdapterInterface;
|
use Thelia\Coupon\FacadeInterface;
|
||||||
use Thelia\Coupon\ConditionCollection;
|
use Thelia\Coupon\ConditionCollection;
|
||||||
|
|
||||||
|
|
||||||
@@ -644,7 +644,7 @@ function generateCouponFixtures(\Thelia\Core\Thelia $thelia)
|
|||||||
{
|
{
|
||||||
/** @var $container ContainerInterface Service Container */
|
/** @var $container ContainerInterface Service Container */
|
||||||
$container = $thelia->getContainer();
|
$container = $thelia->getContainer();
|
||||||
/** @var AdapterInterface $adapter */
|
/** @var FacadeInterface $adapter */
|
||||||
$adapter = $container->get('thelia.adapter');
|
$adapter = $container->get('thelia.adapter');
|
||||||
|
|
||||||
// Coupons
|
// Coupons
|
||||||
|
|||||||
0
web/cache/.gitkeep
vendored
Normal file → Executable file
0
web/cache/.gitkeep
vendored
Normal file → Executable file
Reference in New Issue
Block a user