Working : Coupon : Fixing unit tests

This commit is contained in:
gmorel
2013-10-14 22:42:12 +02:00
parent 55c60ed89e
commit c5cd35f85e
5 changed files with 235 additions and 235 deletions

View File

@@ -57,21 +57,21 @@ class ConditionEvaluatorTest extends \PHPUnit_Framework_TestCase
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter') $stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getTranslator') ->method('getTranslator')
->will($this->returnValue($stubTranslator)); ->will($this->returnValue($stubTranslator));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getConditionEvaluator') ->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator())); ->will($this->returnValue(new ConditionEvaluator()));
$currencies = CurrencyQuery::create(); $currencies = CurrencyQuery::create();
$currencies = $currencies->find(); $currencies = $currencies->find();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getAvailableCurrencies') ->method('getAvailableCurrencies')
->will($this->returnValue($currencies)); ->will($this->returnValue($currencies));
@@ -94,17 +94,17 @@ class ConditionEvaluatorTest extends \PHPUnit_Framework_TestCase
->method('has') ->method('has')
->will($this->returnValue(true)); ->will($this->returnValue(true));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getContainer') ->method('getContainer')
->will($this->returnValue($stubContainer)); ->will($this->returnValue($stubContainer));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getCheckoutCurrency') ->method('getCheckoutCurrency')
->will($this->returnValue('EUR')); ->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getCartTotalPrice') ->method('getCartTotalPrice')
->will($this->returnValue(401.00)); ->will($this->returnValue(401.00));
$condition1 = new MatchForTotalAmountManager($stubAdapter); $condition1 = new MatchForTotalAmountManager($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmountManager::INPUT1 => '>', MatchForTotalAmountManager::INPUT1 => '>',
MatchForTotalAmountManager::INPUT2 => '==' MatchForTotalAmountManager::INPUT2 => '=='
@@ -131,21 +131,21 @@ class ConditionEvaluatorTest extends \PHPUnit_Framework_TestCase
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter') $stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getTranslator') ->method('getTranslator')
->will($this->returnValue($stubTranslator)); ->will($this->returnValue($stubTranslator));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getConditionEvaluator') ->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator())); ->will($this->returnValue(new ConditionEvaluator()));
$currencies = CurrencyQuery::create(); $currencies = CurrencyQuery::create();
$currencies = $currencies->find(); $currencies = $currencies->find();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getAvailableCurrencies') ->method('getAvailableCurrencies')
->will($this->returnValue($currencies)); ->will($this->returnValue($currencies));
@@ -168,17 +168,17 @@ class ConditionEvaluatorTest extends \PHPUnit_Framework_TestCase
->method('has') ->method('has')
->will($this->returnValue(true)); ->will($this->returnValue(true));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getContainer') ->method('getContainer')
->will($this->returnValue($stubContainer)); ->will($this->returnValue($stubContainer));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getCheckoutCurrency') ->method('getCheckoutCurrency')
->will($this->returnValue('EUR')); ->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getCartTotalPrice') ->method('getCartTotalPrice')
->will($this->returnValue(400.00)); ->will($this->returnValue(400.00));
$condition1 = new MatchForTotalAmountManager($stubAdapter); $condition1 = new MatchForTotalAmountManager($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmountManager::INPUT1 => '>', MatchForTotalAmountManager::INPUT1 => '>',
MatchForTotalAmountManager::INPUT2 => '==' MatchForTotalAmountManager::INPUT2 => '=='
@@ -205,21 +205,21 @@ class ConditionEvaluatorTest extends \PHPUnit_Framework_TestCase
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter') $stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getTranslator') ->method('getTranslator')
->will($this->returnValue($stubTranslator)); ->will($this->returnValue($stubTranslator));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getConditionEvaluator') ->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator())); ->will($this->returnValue(new ConditionEvaluator()));
$currencies = CurrencyQuery::create(); $currencies = CurrencyQuery::create();
$currencies = $currencies->find(); $currencies = $currencies->find();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getAvailableCurrencies') ->method('getAvailableCurrencies')
->will($this->returnValue($currencies)); ->will($this->returnValue($currencies));
@@ -242,20 +242,20 @@ class ConditionEvaluatorTest extends \PHPUnit_Framework_TestCase
->method('has') ->method('has')
->will($this->returnValue(true)); ->will($this->returnValue(true));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getContainer') ->method('getContainer')
->will($this->returnValue($stubContainer)); ->will($this->returnValue($stubContainer));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getCheckoutCurrency') ->method('getCheckoutCurrency')
->will($this->returnValue('EUR')); ->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getCartTotalPrice') ->method('getCartTotalPrice')
->will($this->returnValue(401.00)); ->will($this->returnValue(401.00));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getNbArticlesInCart') ->method('getNbArticlesInCart')
->will($this->returnValue(5)); ->will($this->returnValue(5));
$condition1 = new MatchForTotalAmountManager($stubAdapter); $condition1 = new MatchForTotalAmountManager($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmountManager::INPUT1 => '>', MatchForTotalAmountManager::INPUT1 => '>',
MatchForTotalAmountManager::INPUT2 => '==' MatchForTotalAmountManager::INPUT2 => '=='
@@ -265,7 +265,7 @@ class ConditionEvaluatorTest extends \PHPUnit_Framework_TestCase
MatchForTotalAmountManager::INPUT2 => 'EUR'); MatchForTotalAmountManager::INPUT2 => 'EUR');
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
$condition2 = new MatchForXArticlesManager($stubAdapter); $condition2 = new MatchForXArticlesManager($stubFacade);
$operators = array( $operators = array(
MatchForXArticlesManager::INPUT1 => '>' MatchForXArticlesManager::INPUT1 => '>'
); );
@@ -292,21 +292,21 @@ class ConditionEvaluatorTest extends \PHPUnit_Framework_TestCase
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter') $stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getTranslator') ->method('getTranslator')
->will($this->returnValue($stubTranslator)); ->will($this->returnValue($stubTranslator));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getConditionEvaluator') ->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator())); ->will($this->returnValue(new ConditionEvaluator()));
$currencies = CurrencyQuery::create(); $currencies = CurrencyQuery::create();
$currencies = $currencies->find(); $currencies = $currencies->find();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getAvailableCurrencies') ->method('getAvailableCurrencies')
->will($this->returnValue($currencies)); ->will($this->returnValue($currencies));
@@ -329,20 +329,20 @@ class ConditionEvaluatorTest extends \PHPUnit_Framework_TestCase
->method('has') ->method('has')
->will($this->returnValue(true)); ->will($this->returnValue(true));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getContainer') ->method('getContainer')
->will($this->returnValue($stubContainer)); ->will($this->returnValue($stubContainer));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getCheckoutCurrency') ->method('getCheckoutCurrency')
->will($this->returnValue('EUR')); ->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getCartTotalPrice') ->method('getCartTotalPrice')
->will($this->returnValue(400.00)); ->will($this->returnValue(400.00));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getNbArticlesInCart') ->method('getNbArticlesInCart')
->will($this->returnValue(5)); ->will($this->returnValue(5));
$condition1 = new MatchForTotalAmountManager($stubAdapter); $condition1 = new MatchForTotalAmountManager($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmountManager::INPUT1 => '>', MatchForTotalAmountManager::INPUT1 => '>',
MatchForTotalAmountManager::INPUT2 => '==' MatchForTotalAmountManager::INPUT2 => '=='
@@ -352,7 +352,7 @@ class ConditionEvaluatorTest extends \PHPUnit_Framework_TestCase
MatchForTotalAmountManager::INPUT2 => 'EUR'); MatchForTotalAmountManager::INPUT2 => 'EUR');
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
$condition2 = new MatchForXArticlesManager($stubAdapter); $condition2 = new MatchForXArticlesManager($stubFacade);
$operators = array( $operators = array(
MatchForXArticlesManager::INPUT1 => '>' MatchForXArticlesManager::INPUT1 => '>'
); );

View File

@@ -61,21 +61,21 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter') $stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getTranslator') ->method('getTranslator')
->will($this->returnValue($stubTranslator)); ->will($this->returnValue($stubTranslator));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getConditionEvaluator') ->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator())); ->will($this->returnValue(new ConditionEvaluator()));
$currencies = CurrencyQuery::create(); $currencies = CurrencyQuery::create();
$currencies = $currencies->find(); $currencies = $currencies->find();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getAvailableCurrencies') ->method('getAvailableCurrencies')
->will($this->returnValue($currencies)); ->will($this->returnValue($currencies));
@@ -84,17 +84,17 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
->getMock(); ->getMock();
$stubContainer->expects($this->any()) $stubContainer->expects($this->any())
->method('get') ->method('get')
->will($this->returnValue(new MatchForTotalAmountManager($stubAdapter))); ->will($this->returnValue(new MatchForTotalAmountManager($stubFacade)));
$stubContainer->expects($this->any()) $stubContainer->expects($this->any())
->method('has') ->method('has')
->will($this->returnValue(true)); ->will($this->returnValue(true));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getContainer') ->method('getContainer')
->will($this->returnValue($stubContainer)); ->will($this->returnValue($stubContainer));
$condition1 = new MatchForTotalAmountManager($stubAdapter); $condition1 = new MatchForTotalAmountManager($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR, MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
@@ -125,21 +125,21 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter') $stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getTranslator') ->method('getTranslator')
->will($this->returnValue($stubTranslator)); ->will($this->returnValue($stubTranslator));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getConditionEvaluator') ->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator())); ->will($this->returnValue(new ConditionEvaluator()));
$currencies = CurrencyQuery::create(); $currencies = CurrencyQuery::create();
$currencies = $currencies->find(); $currencies = $currencies->find();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getAvailableCurrencies') ->method('getAvailableCurrencies')
->will($this->returnValue($currencies)); ->will($this->returnValue($currencies));
@@ -148,17 +148,17 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
->getMock(); ->getMock();
$stubContainer->expects($this->any()) $stubContainer->expects($this->any())
->method('get') ->method('get')
->will($this->returnValue(new MatchForTotalAmountManager($stubAdapter))); ->will($this->returnValue(new MatchForTotalAmountManager($stubFacade)));
$stubContainer->expects($this->any()) $stubContainer->expects($this->any())
->method('has') ->method('has')
->will($this->returnValueMap(array('unset.service', false))); ->will($this->returnValueMap(array('unset.service', false)));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getContainer') ->method('getContainer')
->will($this->returnValue($stubContainer)); ->will($this->returnValue($stubContainer));
$condition1 = new MatchForTotalAmountManager($stubAdapter); $condition1 = new MatchForTotalAmountManager($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR, MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
@@ -187,21 +187,21 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter') $stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getTranslator') ->method('getTranslator')
->will($this->returnValue($stubTranslator)); ->will($this->returnValue($stubTranslator));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getConditionEvaluator') ->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator())); ->will($this->returnValue(new ConditionEvaluator()));
$currencies = CurrencyQuery::create(); $currencies = CurrencyQuery::create();
$currencies = $currencies->find(); $currencies = $currencies->find();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getAvailableCurrencies') ->method('getAvailableCurrencies')
->will($this->returnValue($currencies)); ->will($this->returnValue($currencies));
@@ -210,17 +210,17 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
->getMock(); ->getMock();
$stubContainer->expects($this->any()) $stubContainer->expects($this->any())
->method('get') ->method('get')
->will($this->returnValue(new MatchForTotalAmountManager($stubAdapter))); ->will($this->returnValue(new MatchForTotalAmountManager($stubFacade)));
$stubContainer->expects($this->any()) $stubContainer->expects($this->any())
->method('has') ->method('has')
->will($this->returnValue(true)); ->will($this->returnValue(true));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getContainer') ->method('getContainer')
->will($this->returnValue($stubContainer)); ->will($this->returnValue($stubContainer));
$condition1 = new MatchForTotalAmountManager($stubAdapter); $condition1 = new MatchForTotalAmountManager($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR, MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
@@ -231,7 +231,7 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
); );
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
$condition2 = new MatchForTotalAmountManager($stubAdapter); $condition2 = new MatchForTotalAmountManager($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR, MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
@@ -266,28 +266,28 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter') $stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getTranslator') ->method('getTranslator')
->will($this->returnValue($stubTranslator)); ->will($this->returnValue($stubTranslator));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getConditionEvaluator') ->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator())); ->will($this->returnValue(new ConditionEvaluator()));
$currencies = CurrencyQuery::create(); $currencies = CurrencyQuery::create();
$currencies = $currencies->find(); $currencies = $currencies->find();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getAvailableCurrencies') ->method('getAvailableCurrencies')
->will($this->returnValue($currencies)); ->will($this->returnValue($currencies));
$stubContainer = $this->getMockBuilder('\Symfony\Component\DependencyInjection\Container') $stubContainer = $this->getMockBuilder('\Symfony\Component\DependencyInjection\Container')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$condition1 = new MatchForTotalAmountManager($stubAdapter); $condition1 = new MatchForTotalAmountManager($stubFacade);
$stubContainer->expects($this->any()) $stubContainer->expects($this->any())
->method('get') ->method('get')
->will($this->returnValue($condition1)); ->will($this->returnValue($condition1));
@@ -296,7 +296,7 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
->method('has') ->method('has')
->will($this->returnValue(true)); ->will($this->returnValue(true));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getContainer') ->method('getContainer')
->will($this->returnValue($stubContainer)); ->will($this->returnValue($stubContainer));
@@ -331,28 +331,28 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter') $stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getTranslator') ->method('getTranslator')
->will($this->returnValue($stubTranslator)); ->will($this->returnValue($stubTranslator));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getConditionEvaluator') ->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator())); ->will($this->returnValue(new ConditionEvaluator()));
$currencies = CurrencyQuery::create(); $currencies = CurrencyQuery::create();
$currencies = $currencies->find(); $currencies = $currencies->find();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getAvailableCurrencies') ->method('getAvailableCurrencies')
->will($this->returnValue($currencies)); ->will($this->returnValue($currencies));
$stubContainer = $this->getMockBuilder('\Symfony\Component\DependencyInjection\Container') $stubContainer = $this->getMockBuilder('\Symfony\Component\DependencyInjection\Container')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$condition1 = new MatchForTotalAmountManager($stubAdapter); $condition1 = new MatchForTotalAmountManager($stubFacade);
$stubContainer->expects($this->any()) $stubContainer->expects($this->any())
->method('get') ->method('get')
->will($this->returnValue($condition1)); ->will($this->returnValue($condition1));
@@ -361,7 +361,7 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
->method('has') ->method('has')
->will($this->returnValue(false)); ->will($this->returnValue(false));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getContainer') ->method('getContainer')
->will($this->returnValue($stubContainer)); ->will($this->returnValue($stubContainer));

View File

@@ -54,19 +54,19 @@ class MatchForEveryoneManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function generateAdapterStub($cartTotalPrice = 400, $checkoutCurrency = 'EUR') public function generateAdapterStub($cartTotalPrice = 400, $checkoutCurrency = 'EUR')
{ {
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter') $stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getCartTotalPrice') ->method('getCartTotalPrice')
->will($this->returnValue($cartTotalPrice)); ->will($this->returnValue($cartTotalPrice));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getCheckoutCurrency') ->method('getCheckoutCurrency')
->will($this->returnValue($checkoutCurrency)); ->will($this->returnValue($checkoutCurrency));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getConditionEvaluator') ->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator())); ->will($this->returnValue(new ConditionEvaluator()));
@@ -74,11 +74,11 @@ class MatchForEveryoneManagerTest extends \PHPUnit_Framework_TestCase
$currency1->setCode('EUR'); $currency1->setCode('EUR');
$currency2 = new Currency(); $currency2 = new Currency();
$currency2->setCode('USD'); $currency2->setCode('USD');
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getAvailableCurrencies') ->method('getAvailableCurrencies')
->will($this->returnValue(array($currency1, $currency2))); ->will($this->returnValue(array($currency1, $currency2)));
return $stubAdapter; return $stubFacade;
} }
/** /**
@@ -89,10 +89,10 @@ class MatchForEveryoneManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function testValidBackOfficeInputOperator() public function testValidBackOfficeInputOperator()
{ {
$stubAdapter = $this->generateAdapterStub(399, 'EUR'); $stubFacade = $this->generateAdapterStub(399, 'EUR');
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$condition1 = new MatchForEveryoneManager($stubAdapter); $condition1 = new MatchForEveryoneManager($stubFacade);
$operators = array(); $operators = array();
$values = array(); $values = array();
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
@@ -112,10 +112,10 @@ class MatchForEveryoneManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function testIsMatching() public function testIsMatching()
{ {
$stubAdapter = $this->generateAdapterStub(399, 'EUR'); $stubFacade = $this->generateAdapterStub(399, 'EUR');
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$condition1 = new MatchForEveryoneManager($stubAdapter); $condition1 = new MatchForEveryoneManager($stubFacade);
$isValid = $condition1->isMatching(); $isValid = $condition1->isMatching();

View File

@@ -55,19 +55,19 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function generateAdapterStub($cartTotalPrice = 400, $checkoutCurrency = 'EUR') public function generateAdapterStub($cartTotalPrice = 400, $checkoutCurrency = 'EUR')
{ {
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter') $stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getCartTotalPrice') ->method('getCartTotalPrice')
->will($this->returnValue($cartTotalPrice)); ->will($this->returnValue($cartTotalPrice));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getCheckoutCurrency') ->method('getCheckoutCurrency')
->will($this->returnValue($checkoutCurrency)); ->will($this->returnValue($checkoutCurrency));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getConditionEvaluator') ->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator())); ->will($this->returnValue(new ConditionEvaluator()));
@@ -75,11 +75,11 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
$currency1->setCode('EUR'); $currency1->setCode('EUR');
$currency2 = new Currency(); $currency2 = new Currency();
$currency2->setCode('USD'); $currency2->setCode('USD');
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getAvailableCurrencies') ->method('getAvailableCurrencies')
->will($this->returnValue(array($currency1, $currency2))); ->will($this->returnValue(array($currency1, $currency2)));
return $stubAdapter; return $stubFacade;
} }
/** /**
@@ -100,10 +100,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function testInValidBackOfficeInputOperator() public function testInValidBackOfficeInputOperator()
{ {
$stubAdapter = $this->generateAdapterStub(399, 'EUR'); $stubFacade = $this->generateAdapterStub(399, 'EUR');
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$condition1 = new MatchForTotalAmountManager($stubAdapter); $condition1 = new MatchForTotalAmountManager($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::IN, MatchForTotalAmountManager::INPUT1 => Operators::IN,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
@@ -129,10 +129,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function testInValidBackOfficeInputOperator2() public function testInValidBackOfficeInputOperator2()
{ {
$stubAdapter = $this->generateAdapterStub(399, 'EUR'); $stubFacade = $this->generateAdapterStub(399, 'EUR');
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$condition1 = new MatchForTotalAmountManager($stubAdapter); $condition1 = new MatchForTotalAmountManager($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR, MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmountManager::INPUT2 => Operators::INFERIOR MatchForTotalAmountManager::INPUT2 => Operators::INFERIOR
@@ -158,10 +158,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function testInValidBackOfficeInputValue() public function testInValidBackOfficeInputValue()
{ {
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->generateAdapterStub(399, 'EUR'); $stubFacade = $this->generateAdapterStub(399, 'EUR');
$condition1 = new MatchForTotalAmountManager($stubAdapter); $condition1 = new MatchForTotalAmountManager($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR, MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
@@ -187,10 +187,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function testInValidBackOfficeInputValue2() public function testInValidBackOfficeInputValue2()
{ {
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->generateAdapterStub(399, 'EUR'); $stubFacade = $this->generateAdapterStub(399, 'EUR');
$condition1 = new MatchForTotalAmountManager($stubAdapter); $condition1 = new MatchForTotalAmountManager($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR, MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
@@ -215,10 +215,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function testMatchingConditionInferior() public function testMatchingConditionInferior()
{ {
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->generateAdapterStub(399, 'EUR'); $stubFacade = $this->generateAdapterStub(399, 'EUR');
$condition1 = new MatchForTotalAmountManager($stubAdapter); $condition1 = new MatchForTotalAmountManager($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::INFERIOR, MatchForTotalAmountManager::INPUT1 => Operators::INFERIOR,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
@@ -243,10 +243,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function testNotMatchingConditionInferior() public function testNotMatchingConditionInferior()
{ {
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->generateAdapterStub(400, 'EUR'); $stubFacade = $this->generateAdapterStub(400, 'EUR');
$condition1 = new MatchForTotalAmountManager($stubAdapter); $condition1 = new MatchForTotalAmountManager($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::INFERIOR, MatchForTotalAmountManager::INPUT1 => Operators::INFERIOR,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
@@ -271,10 +271,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function testMatchingConditionInferiorEquals() public function testMatchingConditionInferiorEquals()
{ {
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->generateAdapterStub(400, 'EUR'); $stubFacade = $this->generateAdapterStub(400, 'EUR');
$condition1 = new MatchForTotalAmountManager($stubAdapter); $condition1 = new MatchForTotalAmountManager($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::INFERIOR_OR_EQUAL, MatchForTotalAmountManager::INPUT1 => Operators::INFERIOR_OR_EQUAL,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
@@ -299,10 +299,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function testMatchingConditionInferiorEquals2() public function testMatchingConditionInferiorEquals2()
{ {
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->generateAdapterStub(399, 'EUR'); $stubFacade = $this->generateAdapterStub(399, 'EUR');
$condition1 = new MatchForTotalAmountManager($stubAdapter); $condition1 = new MatchForTotalAmountManager($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::INFERIOR_OR_EQUAL, MatchForTotalAmountManager::INPUT1 => Operators::INFERIOR_OR_EQUAL,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
@@ -327,10 +327,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function testNotMatchingConditionInferiorEquals() public function testNotMatchingConditionInferiorEquals()
{ {
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->generateAdapterStub(401, 'EUR'); $stubFacade = $this->generateAdapterStub(401, 'EUR');
$condition1 = new MatchForTotalAmountManager($stubAdapter); $condition1 = new MatchForTotalAmountManager($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::INFERIOR_OR_EQUAL, MatchForTotalAmountManager::INPUT1 => Operators::INFERIOR_OR_EQUAL,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
@@ -355,10 +355,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function testMatchingConditionEqual() public function testMatchingConditionEqual()
{ {
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->generateAdapterStub(400, 'EUR'); $stubFacade = $this->generateAdapterStub(400, 'EUR');
$condition1 = new MatchForTotalAmountManager($stubAdapter); $condition1 = new MatchForTotalAmountManager($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::EQUAL, MatchForTotalAmountManager::INPUT1 => Operators::EQUAL,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
@@ -383,10 +383,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function testNotMatchingConditionEqual() public function testNotMatchingConditionEqual()
{ {
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->generateAdapterStub(399, 'EUR'); $stubFacade = $this->generateAdapterStub(399, 'EUR');
$condition1 = new MatchForTotalAmountManager($stubAdapter); $condition1 = new MatchForTotalAmountManager($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::EQUAL, MatchForTotalAmountManager::INPUT1 => Operators::EQUAL,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
@@ -411,10 +411,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function testMatchingConditionSuperiorEquals() public function testMatchingConditionSuperiorEquals()
{ {
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->generateAdapterStub(401, 'EUR'); $stubFacade = $this->generateAdapterStub(401, 'EUR');
$condition1 = new MatchForTotalAmountManager($stubAdapter); $condition1 = new MatchForTotalAmountManager($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR_OR_EQUAL, MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR_OR_EQUAL,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
@@ -439,10 +439,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function testMatchingConditionSuperiorEquals2() public function testMatchingConditionSuperiorEquals2()
{ {
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->generateAdapterStub(400, 'EUR'); $stubFacade = $this->generateAdapterStub(400, 'EUR');
$condition1 = new MatchForTotalAmountManager($stubAdapter); $condition1 = new MatchForTotalAmountManager($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR_OR_EQUAL, MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR_OR_EQUAL,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
@@ -467,10 +467,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function testNotMatchingConditionSuperiorEquals() public function testNotMatchingConditionSuperiorEquals()
{ {
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->generateAdapterStub(399, 'EUR'); $stubFacade = $this->generateAdapterStub(399, 'EUR');
$condition1 = new MatchForTotalAmountManager($stubAdapter); $condition1 = new MatchForTotalAmountManager($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR_OR_EQUAL, MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR_OR_EQUAL,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
@@ -495,10 +495,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function testMatchingConditionSuperior() public function testMatchingConditionSuperior()
{ {
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->generateAdapterStub(401, 'EUR'); $stubFacade = $this->generateAdapterStub(401, 'EUR');
$condition1 = new MatchForTotalAmountManager($stubAdapter); $condition1 = new MatchForTotalAmountManager($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR, MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
@@ -523,10 +523,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function testNotMatchingConditionSuperior() public function testNotMatchingConditionSuperior()
{ {
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->generateAdapterStub(399, 'EUR'); $stubFacade = $this->generateAdapterStub(399, 'EUR');
$condition1 = new MatchForTotalAmountManager($stubAdapter); $condition1 = new MatchForTotalAmountManager($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR, MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
@@ -551,10 +551,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function testMatchingConditionCurrency() public function testMatchingConditionCurrency()
{ {
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->generateAdapterStub(400, 'EUR'); $stubFacade = $this->generateAdapterStub(400, 'EUR');
$condition1 = new MatchForTotalAmountManager($stubAdapter); $condition1 = new MatchForTotalAmountManager($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::EQUAL, MatchForTotalAmountManager::INPUT1 => Operators::EQUAL,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
@@ -579,10 +579,10 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function testNotMatchingConditionCurrency() public function testNotMatchingConditionCurrency()
{ {
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->generateAdapterStub(400.00, 'EUR'); $stubFacade = $this->generateAdapterStub(400.00, 'EUR');
$condition1 = new MatchForTotalAmountManager($stubAdapter); $condition1 = new MatchForTotalAmountManager($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::EQUAL, MatchForTotalAmountManager::INPUT1 => Operators::EQUAL,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL MatchForTotalAmountManager::INPUT2 => Operators::EQUAL

View File

@@ -59,20 +59,20 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function testInValidBackOfficeInputOperator() public function testInValidBackOfficeInputOperator()
{ {
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter') $stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getNbArticlesInCart') ->method('getNbArticlesInCart')
->will($this->returnValue(4)); ->will($this->returnValue(4));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getConditionEvaluator') ->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator())); ->will($this->returnValue(new ConditionEvaluator()));
$condition1 = new MatchForXArticlesManager($stubAdapter); $condition1 = new MatchForXArticlesManager($stubFacade);
$operators = array( $operators = array(
MatchForXArticlesManager::INPUT1 => Operators::IN MatchForXArticlesManager::INPUT1 => Operators::IN
); );
@@ -96,19 +96,19 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function testInValidBackOfficeInputValue() public function testInValidBackOfficeInputValue()
{ {
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter') $stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getNbArticlesInCart') ->method('getNbArticlesInCart')
->will($this->returnValue(4)); ->will($this->returnValue(4));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getConditionEvaluator') ->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator())); ->will($this->returnValue(new ConditionEvaluator()));
$condition1 = new MatchForXArticlesManager($stubAdapter); $condition1 = new MatchForXArticlesManager($stubFacade);
$operators = array( $operators = array(
MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR
); );
@@ -132,19 +132,19 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function testMatchingRuleInferior() public function testMatchingRuleInferior()
{ {
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter') $stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getNbArticlesInCart') ->method('getNbArticlesInCart')
->will($this->returnValue(4)); ->will($this->returnValue(4));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getConditionEvaluator') ->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator())); ->will($this->returnValue(new ConditionEvaluator()));
$condition1 = new MatchForXArticlesManager($stubAdapter); $condition1 = new MatchForXArticlesManager($stubFacade);
$operators = array( $operators = array(
MatchForXArticlesManager::INPUT1 => Operators::INFERIOR MatchForXArticlesManager::INPUT1 => Operators::INFERIOR
); );
@@ -168,19 +168,19 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function testNotMatchingRuleInferior() public function testNotMatchingRuleInferior()
{ {
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter') $stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getNbArticlesInCart') ->method('getNbArticlesInCart')
->will($this->returnValue(4)); ->will($this->returnValue(4));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getConditionEvaluator') ->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator())); ->will($this->returnValue(new ConditionEvaluator()));
$condition1 = new MatchForXArticlesManager($stubAdapter); $condition1 = new MatchForXArticlesManager($stubFacade);
$operators = array( $operators = array(
MatchForXArticlesManager::INPUT1 => Operators::INFERIOR MatchForXArticlesManager::INPUT1 => Operators::INFERIOR
); );
@@ -204,19 +204,19 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function testMatchingRuleInferiorEquals() public function testMatchingRuleInferiorEquals()
{ {
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter') $stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getNbArticlesInCart') ->method('getNbArticlesInCart')
->will($this->returnValue(4)); ->will($this->returnValue(4));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getConditionEvaluator') ->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator())); ->will($this->returnValue(new ConditionEvaluator()));
$condition1 = new MatchForXArticlesManager($stubAdapter); $condition1 = new MatchForXArticlesManager($stubFacade);
$operators = array( $operators = array(
MatchForXArticlesManager::INPUT1 => Operators::INFERIOR_OR_EQUAL, MatchForXArticlesManager::INPUT1 => Operators::INFERIOR_OR_EQUAL,
); );
@@ -240,19 +240,19 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function testMatchingRuleInferiorEquals2() public function testMatchingRuleInferiorEquals2()
{ {
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter') $stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getNbArticlesInCart') ->method('getNbArticlesInCart')
->will($this->returnValue(4)); ->will($this->returnValue(4));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getConditionEvaluator') ->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator())); ->will($this->returnValue(new ConditionEvaluator()));
$condition1 = new MatchForXArticlesManager($stubAdapter); $condition1 = new MatchForXArticlesManager($stubFacade);
$operators = array( $operators = array(
MatchForXArticlesManager::INPUT1 => Operators::INFERIOR_OR_EQUAL MatchForXArticlesManager::INPUT1 => Operators::INFERIOR_OR_EQUAL
); );
@@ -276,19 +276,19 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function testNotMatchingRuleInferiorEquals() public function testNotMatchingRuleInferiorEquals()
{ {
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter') $stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getNbArticlesInCart') ->method('getNbArticlesInCart')
->will($this->returnValue(4)); ->will($this->returnValue(4));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getConditionEvaluator') ->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator())); ->will($this->returnValue(new ConditionEvaluator()));
$condition1 = new MatchForXArticlesManager($stubAdapter); $condition1 = new MatchForXArticlesManager($stubFacade);
$operators = array( $operators = array(
MatchForXArticlesManager::INPUT1 => Operators::INFERIOR_OR_EQUAL MatchForXArticlesManager::INPUT1 => Operators::INFERIOR_OR_EQUAL
); );
@@ -312,19 +312,19 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function testMatchingRuleEqual() public function testMatchingRuleEqual()
{ {
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter') $stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getNbArticlesInCart') ->method('getNbArticlesInCart')
->will($this->returnValue(4)); ->will($this->returnValue(4));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getConditionEvaluator') ->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator())); ->will($this->returnValue(new ConditionEvaluator()));
$condition1 = new MatchForXArticlesManager($stubAdapter); $condition1 = new MatchForXArticlesManager($stubFacade);
$operators = array( $operators = array(
MatchForXArticlesManager::INPUT1 => Operators::EQUAL MatchForXArticlesManager::INPUT1 => Operators::EQUAL
); );
@@ -348,19 +348,19 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function testNotMatchingRuleEqual() public function testNotMatchingRuleEqual()
{ {
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter') $stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getNbArticlesInCart') ->method('getNbArticlesInCart')
->will($this->returnValue(4)); ->will($this->returnValue(4));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getConditionEvaluator') ->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator())); ->will($this->returnValue(new ConditionEvaluator()));
$condition1 = new MatchForXArticlesManager($stubAdapter); $condition1 = new MatchForXArticlesManager($stubFacade);
$operators = array( $operators = array(
MatchForXArticlesManager::INPUT1 => Operators::EQUAL MatchForXArticlesManager::INPUT1 => Operators::EQUAL
); );
@@ -384,19 +384,19 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function testMatchingRuleSuperiorEquals() public function testMatchingRuleSuperiorEquals()
{ {
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter') $stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getNbArticlesInCart') ->method('getNbArticlesInCart')
->will($this->returnValue(4)); ->will($this->returnValue(4));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getConditionEvaluator') ->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator())); ->will($this->returnValue(new ConditionEvaluator()));
$condition1 = new MatchForXArticlesManager($stubAdapter); $condition1 = new MatchForXArticlesManager($stubFacade);
$operators = array( $operators = array(
MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR_OR_EQUAL MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR_OR_EQUAL
); );
@@ -420,19 +420,19 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function testMatchingRuleSuperiorEquals2() public function testMatchingRuleSuperiorEquals2()
{ {
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter') $stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getNbArticlesInCart') ->method('getNbArticlesInCart')
->will($this->returnValue(4)); ->will($this->returnValue(4));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getConditionEvaluator') ->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator())); ->will($this->returnValue(new ConditionEvaluator()));
$condition1 = new MatchForXArticlesManager($stubAdapter); $condition1 = new MatchForXArticlesManager($stubFacade);
$operators = array( $operators = array(
MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR_OR_EQUAL MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR_OR_EQUAL
); );
@@ -456,19 +456,19 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function testNotMatchingRuleSuperiorEquals() public function testNotMatchingRuleSuperiorEquals()
{ {
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter') $stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getNbArticlesInCart') ->method('getNbArticlesInCart')
->will($this->returnValue(4)); ->will($this->returnValue(4));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getConditionEvaluator') ->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator())); ->will($this->returnValue(new ConditionEvaluator()));
$condition1 = new MatchForXArticlesManager($stubAdapter); $condition1 = new MatchForXArticlesManager($stubFacade);
$operators = array( $operators = array(
MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR_OR_EQUAL MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR_OR_EQUAL
); );
@@ -492,19 +492,19 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function testMatchingRuleSuperior() public function testMatchingRuleSuperior()
{ {
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter') $stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getNbArticlesInCart') ->method('getNbArticlesInCart')
->will($this->returnValue(4)); ->will($this->returnValue(4));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getConditionEvaluator') ->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator())); ->will($this->returnValue(new ConditionEvaluator()));
$condition1 = new MatchForXArticlesManager($stubAdapter); $condition1 = new MatchForXArticlesManager($stubFacade);
$operators = array( $operators = array(
MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR
); );
@@ -528,19 +528,19 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
*/ */
public function testNotMatchingRuleSuperior() public function testNotMatchingRuleSuperior()
{ {
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter') $stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getNbArticlesInCart') ->method('getNbArticlesInCart')
->will($this->returnValue(4)); ->will($this->returnValue(4));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getConditionEvaluator') ->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator())); ->will($this->returnValue(new ConditionEvaluator()));
$condition1 = new MatchForXArticlesManager($stubAdapter); $condition1 = new MatchForXArticlesManager($stubFacade);
$operators = array( $operators = array(
MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR
); );
@@ -558,19 +558,19 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
public function testGetSerializableRule() public function testGetSerializableRule()
{ {
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter') $stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getNbArticlesInCart') ->method('getNbArticlesInCart')
->will($this->returnValue(4)); ->will($this->returnValue(4));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getConditionEvaluator') ->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator())); ->will($this->returnValue(new ConditionEvaluator()));
$condition1 = new MatchForXArticlesManager($stubAdapter); $condition1 = new MatchForXArticlesManager($stubFacade);
$operators = array( $operators = array(
MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR
); );
@@ -594,19 +594,19 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
public function testGetAvailableOperators() public function testGetAvailableOperators()
{ {
/** @var FacadeInterface $stubAdapter */ /** @var FacadeInterface $stubFacade */
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter') $stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getNbArticlesInCart') ->method('getNbArticlesInCart')
->will($this->returnValue(4)); ->will($this->returnValue(4));
$stubAdapter->expects($this->any()) $stubFacade->expects($this->any())
->method('getConditionEvaluator') ->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator())); ->will($this->returnValue(new ConditionEvaluator()));
$condition1 = new MatchForXArticlesManager($stubAdapter); $condition1 = new MatchForXArticlesManager($stubFacade);
$operators = array( $operators = array(
MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR
); );
@@ -632,15 +632,15 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
// public function testGetValidators() // public function testGetValidators()
// { // {
// $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseFacade') // $stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
// ->disableOriginalConstructor() // ->disableOriginalConstructor()
// ->getMock(); // ->getMock();
// //
// $stubAdapter->expects($this->any()) // $stubFacade->expects($this->any())
// ->method('getNbArticlesInCart') // ->method('getNbArticlesInCart')
// ->will($this->returnValue(4)); // ->will($this->returnValue(4));
// //
// $condition1 = new MatchForXArticlesManager($stubAdapter); // $condition1 = new MatchForXArticlesManager($stubFacade);
// $operators = array( // $operators = array(
// MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR // MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR
// ); // );