Working : Coupon : Fixing unit tests
This commit is contained in:
@@ -57,21 +57,21 @@ class ConditionEvaluatorTest extends \PHPUnit_Framework_TestCase
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getTranslator')
|
||||
->will($this->returnValue($stubTranslator));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getConditionEvaluator')
|
||||
->will($this->returnValue(new ConditionEvaluator()));
|
||||
|
||||
$currencies = CurrencyQuery::create();
|
||||
$currencies = $currencies->find();
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getAvailableCurrencies')
|
||||
->will($this->returnValue($currencies));
|
||||
|
||||
@@ -94,17 +94,17 @@ class ConditionEvaluatorTest extends \PHPUnit_Framework_TestCase
|
||||
->method('has')
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getContainer')
|
||||
->will($this->returnValue($stubContainer));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getCheckoutCurrency')
|
||||
->will($this->returnValue('EUR'));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getCartTotalPrice')
|
||||
->will($this->returnValue(401.00));
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
$condition1 = new MatchForTotalAmountManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForTotalAmountManager::INPUT1 => '>',
|
||||
MatchForTotalAmountManager::INPUT2 => '=='
|
||||
@@ -131,21 +131,21 @@ class ConditionEvaluatorTest extends \PHPUnit_Framework_TestCase
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getTranslator')
|
||||
->will($this->returnValue($stubTranslator));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getConditionEvaluator')
|
||||
->will($this->returnValue(new ConditionEvaluator()));
|
||||
|
||||
$currencies = CurrencyQuery::create();
|
||||
$currencies = $currencies->find();
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getAvailableCurrencies')
|
||||
->will($this->returnValue($currencies));
|
||||
|
||||
@@ -168,17 +168,17 @@ class ConditionEvaluatorTest extends \PHPUnit_Framework_TestCase
|
||||
->method('has')
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getContainer')
|
||||
->will($this->returnValue($stubContainer));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getCheckoutCurrency')
|
||||
->will($this->returnValue('EUR'));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getCartTotalPrice')
|
||||
->will($this->returnValue(400.00));
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
$condition1 = new MatchForTotalAmountManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForTotalAmountManager::INPUT1 => '>',
|
||||
MatchForTotalAmountManager::INPUT2 => '=='
|
||||
@@ -205,21 +205,21 @@ class ConditionEvaluatorTest extends \PHPUnit_Framework_TestCase
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getTranslator')
|
||||
->will($this->returnValue($stubTranslator));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getConditionEvaluator')
|
||||
->will($this->returnValue(new ConditionEvaluator()));
|
||||
|
||||
$currencies = CurrencyQuery::create();
|
||||
$currencies = $currencies->find();
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getAvailableCurrencies')
|
||||
->will($this->returnValue($currencies));
|
||||
|
||||
@@ -242,20 +242,20 @@ class ConditionEvaluatorTest extends \PHPUnit_Framework_TestCase
|
||||
->method('has')
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getContainer')
|
||||
->will($this->returnValue($stubContainer));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getCheckoutCurrency')
|
||||
->will($this->returnValue('EUR'));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getCartTotalPrice')
|
||||
->will($this->returnValue(401.00));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(5));
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
$condition1 = new MatchForTotalAmountManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForTotalAmountManager::INPUT1 => '>',
|
||||
MatchForTotalAmountManager::INPUT2 => '=='
|
||||
@@ -265,7 +265,7 @@ class ConditionEvaluatorTest extends \PHPUnit_Framework_TestCase
|
||||
MatchForTotalAmountManager::INPUT2 => 'EUR');
|
||||
$condition1->setValidatorsFromForm($operators, $values);
|
||||
|
||||
$condition2 = new MatchForXArticlesManager($stubAdapter);
|
||||
$condition2 = new MatchForXArticlesManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForXArticlesManager::INPUT1 => '>'
|
||||
);
|
||||
@@ -292,21 +292,21 @@ class ConditionEvaluatorTest extends \PHPUnit_Framework_TestCase
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getTranslator')
|
||||
->will($this->returnValue($stubTranslator));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getConditionEvaluator')
|
||||
->will($this->returnValue(new ConditionEvaluator()));
|
||||
|
||||
$currencies = CurrencyQuery::create();
|
||||
$currencies = $currencies->find();
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getAvailableCurrencies')
|
||||
->will($this->returnValue($currencies));
|
||||
|
||||
@@ -329,20 +329,20 @@ class ConditionEvaluatorTest extends \PHPUnit_Framework_TestCase
|
||||
->method('has')
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getContainer')
|
||||
->will($this->returnValue($stubContainer));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getCheckoutCurrency')
|
||||
->will($this->returnValue('EUR'));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getCartTotalPrice')
|
||||
->will($this->returnValue(400.00));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(5));
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
$condition1 = new MatchForTotalAmountManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForTotalAmountManager::INPUT1 => '>',
|
||||
MatchForTotalAmountManager::INPUT2 => '=='
|
||||
@@ -352,7 +352,7 @@ class ConditionEvaluatorTest extends \PHPUnit_Framework_TestCase
|
||||
MatchForTotalAmountManager::INPUT2 => 'EUR');
|
||||
$condition1->setValidatorsFromForm($operators, $values);
|
||||
|
||||
$condition2 = new MatchForXArticlesManager($stubAdapter);
|
||||
$condition2 = new MatchForXArticlesManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForXArticlesManager::INPUT1 => '>'
|
||||
);
|
||||
|
||||
@@ -61,21 +61,21 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getTranslator')
|
||||
->will($this->returnValue($stubTranslator));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getConditionEvaluator')
|
||||
->will($this->returnValue(new ConditionEvaluator()));
|
||||
|
||||
$currencies = CurrencyQuery::create();
|
||||
$currencies = $currencies->find();
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getAvailableCurrencies')
|
||||
->will($this->returnValue($currencies));
|
||||
|
||||
@@ -84,17 +84,17 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
->getMock();
|
||||
$stubContainer->expects($this->any())
|
||||
->method('get')
|
||||
->will($this->returnValue(new MatchForTotalAmountManager($stubAdapter)));
|
||||
->will($this->returnValue(new MatchForTotalAmountManager($stubFacade)));
|
||||
|
||||
$stubContainer->expects($this->any())
|
||||
->method('has')
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getContainer')
|
||||
->will($this->returnValue($stubContainer));
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
$condition1 = new MatchForTotalAmountManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR,
|
||||
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
|
||||
@@ -125,21 +125,21 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getTranslator')
|
||||
->will($this->returnValue($stubTranslator));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getConditionEvaluator')
|
||||
->will($this->returnValue(new ConditionEvaluator()));
|
||||
|
||||
$currencies = CurrencyQuery::create();
|
||||
$currencies = $currencies->find();
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getAvailableCurrencies')
|
||||
->will($this->returnValue($currencies));
|
||||
|
||||
@@ -148,17 +148,17 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
->getMock();
|
||||
$stubContainer->expects($this->any())
|
||||
->method('get')
|
||||
->will($this->returnValue(new MatchForTotalAmountManager($stubAdapter)));
|
||||
->will($this->returnValue(new MatchForTotalAmountManager($stubFacade)));
|
||||
|
||||
$stubContainer->expects($this->any())
|
||||
->method('has')
|
||||
->will($this->returnValueMap(array('unset.service', false)));
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getContainer')
|
||||
->will($this->returnValue($stubContainer));
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
$condition1 = new MatchForTotalAmountManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR,
|
||||
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
|
||||
@@ -187,21 +187,21 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getTranslator')
|
||||
->will($this->returnValue($stubTranslator));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getConditionEvaluator')
|
||||
->will($this->returnValue(new ConditionEvaluator()));
|
||||
|
||||
$currencies = CurrencyQuery::create();
|
||||
$currencies = $currencies->find();
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getAvailableCurrencies')
|
||||
->will($this->returnValue($currencies));
|
||||
|
||||
@@ -210,17 +210,17 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
->getMock();
|
||||
$stubContainer->expects($this->any())
|
||||
->method('get')
|
||||
->will($this->returnValue(new MatchForTotalAmountManager($stubAdapter)));
|
||||
->will($this->returnValue(new MatchForTotalAmountManager($stubFacade)));
|
||||
|
||||
$stubContainer->expects($this->any())
|
||||
->method('has')
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getContainer')
|
||||
->will($this->returnValue($stubContainer));
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
$condition1 = new MatchForTotalAmountManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR,
|
||||
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
|
||||
@@ -231,7 +231,7 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
);
|
||||
$condition1->setValidatorsFromForm($operators, $values);
|
||||
|
||||
$condition2 = new MatchForTotalAmountManager($stubAdapter);
|
||||
$condition2 = new MatchForTotalAmountManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR,
|
||||
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
|
||||
@@ -266,28 +266,28 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getTranslator')
|
||||
->will($this->returnValue($stubTranslator));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getConditionEvaluator')
|
||||
->will($this->returnValue(new ConditionEvaluator()));
|
||||
|
||||
$currencies = CurrencyQuery::create();
|
||||
$currencies = $currencies->find();
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getAvailableCurrencies')
|
||||
->will($this->returnValue($currencies));
|
||||
|
||||
$stubContainer = $this->getMockBuilder('\Symfony\Component\DependencyInjection\Container')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
$condition1 = new MatchForTotalAmountManager($stubFacade);
|
||||
$stubContainer->expects($this->any())
|
||||
->method('get')
|
||||
->will($this->returnValue($condition1));
|
||||
@@ -296,7 +296,7 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
->method('has')
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getContainer')
|
||||
->will($this->returnValue($stubContainer));
|
||||
|
||||
@@ -331,28 +331,28 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getTranslator')
|
||||
->will($this->returnValue($stubTranslator));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getConditionEvaluator')
|
||||
->will($this->returnValue(new ConditionEvaluator()));
|
||||
|
||||
$currencies = CurrencyQuery::create();
|
||||
$currencies = $currencies->find();
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getAvailableCurrencies')
|
||||
->will($this->returnValue($currencies));
|
||||
|
||||
$stubContainer = $this->getMockBuilder('\Symfony\Component\DependencyInjection\Container')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
$condition1 = new MatchForTotalAmountManager($stubFacade);
|
||||
$stubContainer->expects($this->any())
|
||||
->method('get')
|
||||
->will($this->returnValue($condition1));
|
||||
@@ -361,7 +361,7 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
->method('has')
|
||||
->will($this->returnValue(false));
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getContainer')
|
||||
->will($this->returnValue($stubContainer));
|
||||
|
||||
|
||||
@@ -54,19 +54,19 @@ class MatchForEveryoneManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function generateAdapterStub($cartTotalPrice = 400, $checkoutCurrency = 'EUR')
|
||||
{
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
$stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getCartTotalPrice')
|
||||
->will($this->returnValue($cartTotalPrice));
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getCheckoutCurrency')
|
||||
->will($this->returnValue($checkoutCurrency));
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getConditionEvaluator')
|
||||
->will($this->returnValue(new ConditionEvaluator()));
|
||||
|
||||
@@ -74,11 +74,11 @@ class MatchForEveryoneManagerTest extends \PHPUnit_Framework_TestCase
|
||||
$currency1->setCode('EUR');
|
||||
$currency2 = new Currency();
|
||||
$currency2->setCode('USD');
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getAvailableCurrencies')
|
||||
->will($this->returnValue(array($currency1, $currency2)));
|
||||
|
||||
return $stubAdapter;
|
||||
return $stubFacade;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,10 +89,10 @@ class MatchForEveryoneManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testValidBackOfficeInputOperator()
|
||||
{
|
||||
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
||||
$stubFacade = $this->generateAdapterStub(399, 'EUR');
|
||||
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$condition1 = new MatchForEveryoneManager($stubAdapter);
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$condition1 = new MatchForEveryoneManager($stubFacade);
|
||||
$operators = array();
|
||||
$values = array();
|
||||
$condition1->setValidatorsFromForm($operators, $values);
|
||||
@@ -112,10 +112,10 @@ class MatchForEveryoneManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testIsMatching()
|
||||
{
|
||||
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
||||
$stubFacade = $this->generateAdapterStub(399, 'EUR');
|
||||
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$condition1 = new MatchForEveryoneManager($stubAdapter);
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$condition1 = new MatchForEveryoneManager($stubFacade);
|
||||
|
||||
$isValid = $condition1->isMatching();
|
||||
|
||||
|
||||
@@ -55,19 +55,19 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function generateAdapterStub($cartTotalPrice = 400, $checkoutCurrency = 'EUR')
|
||||
{
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
$stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getCartTotalPrice')
|
||||
->will($this->returnValue($cartTotalPrice));
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getCheckoutCurrency')
|
||||
->will($this->returnValue($checkoutCurrency));
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getConditionEvaluator')
|
||||
->will($this->returnValue(new ConditionEvaluator()));
|
||||
|
||||
@@ -75,11 +75,11 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
$currency1->setCode('EUR');
|
||||
$currency2 = new Currency();
|
||||
$currency2->setCode('USD');
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getAvailableCurrencies')
|
||||
->will($this->returnValue(array($currency1, $currency2)));
|
||||
|
||||
return $stubAdapter;
|
||||
return $stubFacade;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,10 +100,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testInValidBackOfficeInputOperator()
|
||||
{
|
||||
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
||||
$stubFacade = $this->generateAdapterStub(399, 'EUR');
|
||||
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$condition1 = new MatchForTotalAmountManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForTotalAmountManager::INPUT1 => Operators::IN,
|
||||
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
|
||||
@@ -129,10 +129,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testInValidBackOfficeInputOperator2()
|
||||
{
|
||||
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
||||
$stubFacade = $this->generateAdapterStub(399, 'EUR');
|
||||
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$condition1 = new MatchForTotalAmountManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR,
|
||||
MatchForTotalAmountManager::INPUT2 => Operators::INFERIOR
|
||||
@@ -158,10 +158,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testInValidBackOfficeInputValue()
|
||||
{
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->generateAdapterStub(399, 'EUR');
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
$condition1 = new MatchForTotalAmountManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR,
|
||||
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
|
||||
@@ -187,10 +187,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testInValidBackOfficeInputValue2()
|
||||
{
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->generateAdapterStub(399, 'EUR');
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
$condition1 = new MatchForTotalAmountManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR,
|
||||
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
|
||||
@@ -215,10 +215,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testMatchingConditionInferior()
|
||||
{
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->generateAdapterStub(399, 'EUR');
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
$condition1 = new MatchForTotalAmountManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForTotalAmountManager::INPUT1 => Operators::INFERIOR,
|
||||
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
|
||||
@@ -243,10 +243,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testNotMatchingConditionInferior()
|
||||
{
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->generateAdapterStub(400, 'EUR');
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->generateAdapterStub(400, 'EUR');
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
$condition1 = new MatchForTotalAmountManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForTotalAmountManager::INPUT1 => Operators::INFERIOR,
|
||||
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
|
||||
@@ -271,10 +271,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testMatchingConditionInferiorEquals()
|
||||
{
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->generateAdapterStub(400, 'EUR');
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->generateAdapterStub(400, 'EUR');
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
$condition1 = new MatchForTotalAmountManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForTotalAmountManager::INPUT1 => Operators::INFERIOR_OR_EQUAL,
|
||||
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
|
||||
@@ -299,10 +299,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testMatchingConditionInferiorEquals2()
|
||||
{
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->generateAdapterStub(399, 'EUR');
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
$condition1 = new MatchForTotalAmountManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForTotalAmountManager::INPUT1 => Operators::INFERIOR_OR_EQUAL,
|
||||
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
|
||||
@@ -327,10 +327,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testNotMatchingConditionInferiorEquals()
|
||||
{
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->generateAdapterStub(401, 'EUR');
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->generateAdapterStub(401, 'EUR');
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
$condition1 = new MatchForTotalAmountManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForTotalAmountManager::INPUT1 => Operators::INFERIOR_OR_EQUAL,
|
||||
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
|
||||
@@ -355,10 +355,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testMatchingConditionEqual()
|
||||
{
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->generateAdapterStub(400, 'EUR');
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->generateAdapterStub(400, 'EUR');
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
$condition1 = new MatchForTotalAmountManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForTotalAmountManager::INPUT1 => Operators::EQUAL,
|
||||
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
|
||||
@@ -383,10 +383,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testNotMatchingConditionEqual()
|
||||
{
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->generateAdapterStub(399, 'EUR');
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
$condition1 = new MatchForTotalAmountManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForTotalAmountManager::INPUT1 => Operators::EQUAL,
|
||||
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
|
||||
@@ -411,10 +411,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testMatchingConditionSuperiorEquals()
|
||||
{
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->generateAdapterStub(401, 'EUR');
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->generateAdapterStub(401, 'EUR');
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
$condition1 = new MatchForTotalAmountManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR_OR_EQUAL,
|
||||
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
|
||||
@@ -439,10 +439,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testMatchingConditionSuperiorEquals2()
|
||||
{
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->generateAdapterStub(400, 'EUR');
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->generateAdapterStub(400, 'EUR');
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
$condition1 = new MatchForTotalAmountManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR_OR_EQUAL,
|
||||
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
|
||||
@@ -467,10 +467,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testNotMatchingConditionSuperiorEquals()
|
||||
{
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->generateAdapterStub(399, 'EUR');
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
$condition1 = new MatchForTotalAmountManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR_OR_EQUAL,
|
||||
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
|
||||
@@ -495,10 +495,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testMatchingConditionSuperior()
|
||||
{
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->generateAdapterStub(401, 'EUR');
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->generateAdapterStub(401, 'EUR');
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
$condition1 = new MatchForTotalAmountManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR,
|
||||
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
|
||||
@@ -523,10 +523,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testNotMatchingConditionSuperior()
|
||||
{
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->generateAdapterStub(399, 'EUR');
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
$condition1 = new MatchForTotalAmountManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR,
|
||||
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
|
||||
@@ -551,10 +551,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testMatchingConditionCurrency()
|
||||
{
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->generateAdapterStub(400, 'EUR');
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->generateAdapterStub(400, 'EUR');
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
$condition1 = new MatchForTotalAmountManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForTotalAmountManager::INPUT1 => Operators::EQUAL,
|
||||
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
|
||||
@@ -579,10 +579,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testNotMatchingConditionCurrency()
|
||||
{
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->generateAdapterStub(400.00, 'EUR');
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->generateAdapterStub(400.00, 'EUR');
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
$condition1 = new MatchForTotalAmountManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForTotalAmountManager::INPUT1 => Operators::EQUAL,
|
||||
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
|
||||
|
||||
@@ -59,20 +59,20 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testInValidBackOfficeInputOperator()
|
||||
{
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter->expects($this->any())
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(4));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getConditionEvaluator')
|
||||
->will($this->returnValue(new ConditionEvaluator()));
|
||||
|
||||
$condition1 = new MatchForXArticlesManager($stubAdapter);
|
||||
$condition1 = new MatchForXArticlesManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForXArticlesManager::INPUT1 => Operators::IN
|
||||
);
|
||||
@@ -96,19 +96,19 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testInValidBackOfficeInputValue()
|
||||
{
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(4));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getConditionEvaluator')
|
||||
->will($this->returnValue(new ConditionEvaluator()));
|
||||
|
||||
$condition1 = new MatchForXArticlesManager($stubAdapter);
|
||||
$condition1 = new MatchForXArticlesManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR
|
||||
);
|
||||
@@ -132,19 +132,19 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testMatchingRuleInferior()
|
||||
{
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(4));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getConditionEvaluator')
|
||||
->will($this->returnValue(new ConditionEvaluator()));
|
||||
|
||||
$condition1 = new MatchForXArticlesManager($stubAdapter);
|
||||
$condition1 = new MatchForXArticlesManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForXArticlesManager::INPUT1 => Operators::INFERIOR
|
||||
);
|
||||
@@ -168,19 +168,19 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testNotMatchingRuleInferior()
|
||||
{
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(4));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getConditionEvaluator')
|
||||
->will($this->returnValue(new ConditionEvaluator()));
|
||||
|
||||
$condition1 = new MatchForXArticlesManager($stubAdapter);
|
||||
$condition1 = new MatchForXArticlesManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForXArticlesManager::INPUT1 => Operators::INFERIOR
|
||||
);
|
||||
@@ -204,19 +204,19 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testMatchingRuleInferiorEquals()
|
||||
{
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(4));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getConditionEvaluator')
|
||||
->will($this->returnValue(new ConditionEvaluator()));
|
||||
|
||||
$condition1 = new MatchForXArticlesManager($stubAdapter);
|
||||
$condition1 = new MatchForXArticlesManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForXArticlesManager::INPUT1 => Operators::INFERIOR_OR_EQUAL,
|
||||
);
|
||||
@@ -240,19 +240,19 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testMatchingRuleInferiorEquals2()
|
||||
{
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(4));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getConditionEvaluator')
|
||||
->will($this->returnValue(new ConditionEvaluator()));
|
||||
|
||||
$condition1 = new MatchForXArticlesManager($stubAdapter);
|
||||
$condition1 = new MatchForXArticlesManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForXArticlesManager::INPUT1 => Operators::INFERIOR_OR_EQUAL
|
||||
);
|
||||
@@ -276,19 +276,19 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testNotMatchingRuleInferiorEquals()
|
||||
{
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(4));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getConditionEvaluator')
|
||||
->will($this->returnValue(new ConditionEvaluator()));
|
||||
|
||||
$condition1 = new MatchForXArticlesManager($stubAdapter);
|
||||
$condition1 = new MatchForXArticlesManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForXArticlesManager::INPUT1 => Operators::INFERIOR_OR_EQUAL
|
||||
);
|
||||
@@ -312,19 +312,19 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testMatchingRuleEqual()
|
||||
{
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(4));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getConditionEvaluator')
|
||||
->will($this->returnValue(new ConditionEvaluator()));
|
||||
|
||||
$condition1 = new MatchForXArticlesManager($stubAdapter);
|
||||
$condition1 = new MatchForXArticlesManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForXArticlesManager::INPUT1 => Operators::EQUAL
|
||||
);
|
||||
@@ -348,19 +348,19 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testNotMatchingRuleEqual()
|
||||
{
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(4));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getConditionEvaluator')
|
||||
->will($this->returnValue(new ConditionEvaluator()));
|
||||
|
||||
$condition1 = new MatchForXArticlesManager($stubAdapter);
|
||||
$condition1 = new MatchForXArticlesManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForXArticlesManager::INPUT1 => Operators::EQUAL
|
||||
);
|
||||
@@ -384,19 +384,19 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testMatchingRuleSuperiorEquals()
|
||||
{
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(4));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getConditionEvaluator')
|
||||
->will($this->returnValue(new ConditionEvaluator()));
|
||||
|
||||
$condition1 = new MatchForXArticlesManager($stubAdapter);
|
||||
$condition1 = new MatchForXArticlesManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR_OR_EQUAL
|
||||
);
|
||||
@@ -420,19 +420,19 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testMatchingRuleSuperiorEquals2()
|
||||
{
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(4));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getConditionEvaluator')
|
||||
->will($this->returnValue(new ConditionEvaluator()));
|
||||
|
||||
$condition1 = new MatchForXArticlesManager($stubAdapter);
|
||||
$condition1 = new MatchForXArticlesManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR_OR_EQUAL
|
||||
);
|
||||
@@ -456,19 +456,19 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testNotMatchingRuleSuperiorEquals()
|
||||
{
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(4));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getConditionEvaluator')
|
||||
->will($this->returnValue(new ConditionEvaluator()));
|
||||
|
||||
$condition1 = new MatchForXArticlesManager($stubAdapter);
|
||||
$condition1 = new MatchForXArticlesManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR_OR_EQUAL
|
||||
);
|
||||
@@ -492,19 +492,19 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testMatchingRuleSuperior()
|
||||
{
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(4));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getConditionEvaluator')
|
||||
->will($this->returnValue(new ConditionEvaluator()));
|
||||
|
||||
$condition1 = new MatchForXArticlesManager($stubAdapter);
|
||||
$condition1 = new MatchForXArticlesManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR
|
||||
);
|
||||
@@ -528,19 +528,19 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testNotMatchingRuleSuperior()
|
||||
{
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(4));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getConditionEvaluator')
|
||||
->will($this->returnValue(new ConditionEvaluator()));
|
||||
|
||||
$condition1 = new MatchForXArticlesManager($stubAdapter);
|
||||
$condition1 = new MatchForXArticlesManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR
|
||||
);
|
||||
@@ -558,19 +558,19 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testGetSerializableRule()
|
||||
{
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(4));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getConditionEvaluator')
|
||||
->will($this->returnValue(new ConditionEvaluator()));
|
||||
|
||||
$condition1 = new MatchForXArticlesManager($stubAdapter);
|
||||
$condition1 = new MatchForXArticlesManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR
|
||||
);
|
||||
@@ -594,19 +594,19 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testGetAvailableOperators()
|
||||
{
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
/** @var FacadeInterface $stubFacade */
|
||||
$stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(4));
|
||||
$stubAdapter->expects($this->any())
|
||||
$stubFacade->expects($this->any())
|
||||
->method('getConditionEvaluator')
|
||||
->will($this->returnValue(new ConditionEvaluator()));
|
||||
|
||||
$condition1 = new MatchForXArticlesManager($stubAdapter);
|
||||
$condition1 = new MatchForXArticlesManager($stubFacade);
|
||||
$operators = array(
|
||||
MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR
|
||||
);
|
||||
@@ -632,15 +632,15 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
// public function testGetValidators()
|
||||
// {
|
||||
// $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
|
||||
// $stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
|
||||
// ->disableOriginalConstructor()
|
||||
// ->getMock();
|
||||
//
|
||||
// $stubAdapter->expects($this->any())
|
||||
// $stubFacade->expects($this->any())
|
||||
// ->method('getNbArticlesInCart')
|
||||
// ->will($this->returnValue(4));
|
||||
//
|
||||
// $condition1 = new MatchForXArticlesManager($stubAdapter);
|
||||
// $condition1 = new MatchForXArticlesManager($stubFacade);
|
||||
// $operators = array(
|
||||
// MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR
|
||||
// );
|
||||
|
||||
Reference in New Issue
Block a user