From 2aa8d804b0e612e45756fa2c9d7343b1f2d7dc62 Mon Sep 17 00:00:00 2001 From: Franck Allimant Date: Sat, 10 May 2014 01:36:11 +0200 Subject: [PATCH] Changed condition parameter name --- .../Condition/ConditionCollectionTest.php | 24 +-- .../Tests/Condition/ConditionFactoryTest.php | 48 ++--- .../MatchForTotalAmountTest.php | 188 +++++++++--------- .../Implementation/MatchForXArticlesTest.php | 108 ++++------ 4 files changed, 165 insertions(+), 203 deletions(-) diff --git a/core/lib/Thelia/Tests/Condition/ConditionCollectionTest.php b/core/lib/Thelia/Tests/Condition/ConditionCollectionTest.php index 679f22791..ee01d5003 100644 --- a/core/lib/Thelia/Tests/Condition/ConditionCollectionTest.php +++ b/core/lib/Thelia/Tests/Condition/ConditionCollectionTest.php @@ -101,12 +101,12 @@ class ConditionCollectionTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForTotalAmount($stubFacade); $operators = array( - MatchForTotalAmount::INPUT1 => Operators::EQUAL, - MatchForTotalAmount::INPUT2 => Operators::EQUAL + MatchForTotalAmount::CART_TOTAL => Operators::EQUAL, + MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL ); $values = array( - MatchForTotalAmount::INPUT1 => 400, - MatchForTotalAmount::INPUT2 => 'EUR'); + MatchForTotalAmount::CART_TOTAL => 400, + MatchForTotalAmount::CART_CURRENCY => 'EUR'); $condition1->setValidatorsFromForm($operators, $values); $collection = new ConditionCollection(); @@ -138,22 +138,22 @@ class ConditionCollectionTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForTotalAmount($stubFacade); $operators1 = array( - MatchForTotalAmount::INPUT1 => Operators::SUPERIOR, - MatchForTotalAmount::INPUT2 => Operators::EQUAL + MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR, + MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL ); $values1 = array( - MatchForTotalAmount::INPUT1 => 400, - MatchForTotalAmount::INPUT2 => 'EUR'); + MatchForTotalAmount::CART_TOTAL => 400, + MatchForTotalAmount::CART_CURRENCY => 'EUR'); $condition1->setValidatorsFromForm($operators1, $values1); $condition2 = new MatchForTotalAmount($stubFacade); $operators2 = array( - MatchForTotalAmount::INPUT1 => Operators::INFERIOR, - MatchForTotalAmount::INPUT2 => Operators::EQUAL + MatchForTotalAmount::CART_TOTAL => Operators::INFERIOR, + MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL ); $values2 = array( - MatchForTotalAmount::INPUT1 => 600, - MatchForTotalAmount::INPUT2 => 'EUR'); + MatchForTotalAmount::CART_TOTAL => 600, + MatchForTotalAmount::CART_CURRENCY => 'EUR'); $condition2->setValidatorsFromForm($operators2, $values2); $collection = new ConditionCollection(); diff --git a/core/lib/Thelia/Tests/Condition/ConditionFactoryTest.php b/core/lib/Thelia/Tests/Condition/ConditionFactoryTest.php index 854803411..2ea9ffe1d 100644 --- a/core/lib/Thelia/Tests/Condition/ConditionFactoryTest.php +++ b/core/lib/Thelia/Tests/Condition/ConditionFactoryTest.php @@ -81,12 +81,12 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForTotalAmount($stubFacade); $operators = array( - MatchForTotalAmount::INPUT1 => Operators::SUPERIOR, - MatchForTotalAmount::INPUT2 => Operators::EQUAL + MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR, + MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL ); $values = array( - MatchForTotalAmount::INPUT1 => 40.00, - MatchForTotalAmount::INPUT2 => 'EUR' + MatchForTotalAmount::CART_TOTAL => 40.00, + MatchForTotalAmount::CART_CURRENCY => 'EUR' ); $condition1->setValidatorsFromForm($operators, $values); @@ -145,12 +145,12 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForTotalAmount($stubFacade); $operators = array( - MatchForTotalAmount::INPUT1 => Operators::SUPERIOR, - MatchForTotalAmount::INPUT2 => Operators::EQUAL + MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR, + MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL ); $values = array( - MatchForTotalAmount::INPUT1 => 40.00, - MatchForTotalAmount::INPUT2 => 'EUR' + MatchForTotalAmount::CART_TOTAL => 40.00, + MatchForTotalAmount::CART_CURRENCY => 'EUR' ); $condition1->setValidatorsFromForm($operators, $values); @@ -207,23 +207,23 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForTotalAmount($stubFacade); $operators = array( - MatchForTotalAmount::INPUT1 => Operators::SUPERIOR, - MatchForTotalAmount::INPUT2 => Operators::EQUAL + MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR, + MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL ); $values = array( - MatchForTotalAmount::INPUT1 => 40.00, - MatchForTotalAmount::INPUT2 => 'EUR' + MatchForTotalAmount::CART_TOTAL => 40.00, + MatchForTotalAmount::CART_CURRENCY => 'EUR' ); $condition1->setValidatorsFromForm($operators, $values); $condition2 = new MatchForTotalAmount($stubFacade); $operators = array( - MatchForTotalAmount::INPUT1 => Operators::SUPERIOR, - MatchForTotalAmount::INPUT2 => Operators::EQUAL + MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR, + MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL ); $values = array( - MatchForTotalAmount::INPUT1 => 400.00, - MatchForTotalAmount::INPUT2 => 'EUR' + MatchForTotalAmount::CART_TOTAL => 400.00, + MatchForTotalAmount::CART_CURRENCY => 'EUR' ); $condition2->setValidatorsFromForm($operators, $values); @@ -286,12 +286,12 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue($stubContainer)); $operators = array( - MatchForTotalAmount::INPUT1 => Operators::SUPERIOR, - MatchForTotalAmount::INPUT2 => Operators::EQUAL + MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR, + MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL ); $values = array( - MatchForTotalAmount::INPUT1 => 40.00, - MatchForTotalAmount::INPUT2 => 'EUR' + MatchForTotalAmount::CART_TOTAL => 40.00, + MatchForTotalAmount::CART_CURRENCY => 'EUR' ); $condition1->setValidatorsFromForm($operators, $values); @@ -351,12 +351,12 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue($stubContainer)); $operators = array( - MatchForTotalAmount::INPUT1 => Operators::SUPERIOR, - MatchForTotalAmount::INPUT2 => Operators::EQUAL + MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR, + MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL ); $values = array( - MatchForTotalAmount::INPUT1 => 40.00, - MatchForTotalAmount::INPUT2 => 'EUR' + MatchForTotalAmount::CART_TOTAL => 40.00, + MatchForTotalAmount::CART_CURRENCY => 'EUR' ); $condition1->setValidatorsFromForm($operators, $values); diff --git a/core/lib/Thelia/Tests/Condition/Implementation/MatchForTotalAmountTest.php b/core/lib/Thelia/Tests/Condition/Implementation/MatchForTotalAmountTest.php index 102132196..bffbda092 100644 --- a/core/lib/Thelia/Tests/Condition/Implementation/MatchForTotalAmountTest.php +++ b/core/lib/Thelia/Tests/Condition/Implementation/MatchForTotalAmountTest.php @@ -94,12 +94,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase /** @var FacadeInterface $stubFacade */ $condition1 = new MatchForTotalAmount($stubFacade); $operators = array( - MatchForTotalAmount::INPUT1 => Operators::IN, - MatchForTotalAmount::INPUT2 => Operators::EQUAL + MatchForTotalAmount::CART_TOTAL => Operators::IN, + MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL ); $values = array( - MatchForTotalAmount::INPUT1 => '400', - MatchForTotalAmount::INPUT2 => 'EUR'); + MatchForTotalAmount::CART_TOTAL => '400', + MatchForTotalAmount::CART_CURRENCY => 'EUR'); $condition1->setValidatorsFromForm($operators, $values); $isValid = $condition1->isMatching(); @@ -123,12 +123,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase /** @var FacadeInterface $stubFacade */ $condition1 = new MatchForTotalAmount($stubFacade); $operators = array( - MatchForTotalAmount::INPUT1 => Operators::SUPERIOR, - MatchForTotalAmount::INPUT2 => Operators::INFERIOR + MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR, + MatchForTotalAmount::CART_CURRENCY => Operators::INFERIOR ); $values = array( - MatchForTotalAmount::INPUT1 => '400', - MatchForTotalAmount::INPUT2 => 'EUR'); + MatchForTotalAmount::CART_TOTAL => '400', + MatchForTotalAmount::CART_CURRENCY => 'EUR'); $condition1->setValidatorsFromForm($operators, $values); $isValid = $condition1->isMatching(); @@ -152,12 +152,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForTotalAmount($stubFacade); $operators = array( - MatchForTotalAmount::INPUT1 => Operators::SUPERIOR, - MatchForTotalAmount::INPUT2 => Operators::EQUAL + MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR, + MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL ); $values = array( - MatchForTotalAmount::INPUT1 => 'X', - MatchForTotalAmount::INPUT2 => 'EUR'); + MatchForTotalAmount::CART_TOTAL => 'X', + MatchForTotalAmount::CART_CURRENCY => 'EUR'); $condition1->setValidatorsFromForm($operators, $values); $isValid = $condition1->isMatching(); @@ -181,12 +181,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForTotalAmount($stubFacade); $operators = array( - MatchForTotalAmount::INPUT1 => Operators::SUPERIOR, - MatchForTotalAmount::INPUT2 => Operators::EQUAL + MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR, + MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL ); $values = array( - MatchForTotalAmount::INPUT1 => 400, - MatchForTotalAmount::INPUT2 => 'FLA'); + MatchForTotalAmount::CART_TOTAL => 400, + MatchForTotalAmount::CART_CURRENCY => 'FLA'); $condition1->setValidatorsFromForm($operators, $values); $isValid = $condition1->isMatching(); @@ -209,12 +209,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForTotalAmount($stubFacade); $operators = array( - MatchForTotalAmount::INPUT1 => Operators::INFERIOR, - MatchForTotalAmount::INPUT2 => Operators::EQUAL + MatchForTotalAmount::CART_TOTAL => Operators::INFERIOR, + MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL ); $values = array( - MatchForTotalAmount::INPUT1 => 400.00, - MatchForTotalAmount::INPUT2 => 'EUR'); + MatchForTotalAmount::CART_TOTAL => 400.00, + MatchForTotalAmount::CART_CURRENCY => 'EUR'); $condition1->setValidatorsFromForm($operators, $values); $isValid = $condition1->isMatching(); @@ -237,12 +237,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForTotalAmount($stubFacade); $operators = array( - MatchForTotalAmount::INPUT1 => Operators::INFERIOR, - MatchForTotalAmount::INPUT2 => Operators::EQUAL + MatchForTotalAmount::CART_TOTAL => Operators::INFERIOR, + MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL ); $values = array( - MatchForTotalAmount::INPUT1 => 400.00, - MatchForTotalAmount::INPUT2 => 'EUR'); + MatchForTotalAmount::CART_TOTAL => 400.00, + MatchForTotalAmount::CART_CURRENCY => 'EUR'); $condition1->setValidatorsFromForm($operators, $values); $isValid = $condition1->isMatching(); @@ -265,12 +265,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForTotalAmount($stubFacade); $operators = array( - MatchForTotalAmount::INPUT1 => Operators::INFERIOR_OR_EQUAL, - MatchForTotalAmount::INPUT2 => Operators::EQUAL + MatchForTotalAmount::CART_TOTAL => Operators::INFERIOR_OR_EQUAL, + MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL ); $values = array( - MatchForTotalAmount::INPUT1 => 400.00, - MatchForTotalAmount::INPUT2 => 'EUR'); + MatchForTotalAmount::CART_TOTAL => 400.00, + MatchForTotalAmount::CART_CURRENCY => 'EUR'); $condition1->setValidatorsFromForm($operators, $values); $isValid = $condition1->isMatching(); @@ -293,12 +293,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForTotalAmount($stubFacade); $operators = array( - MatchForTotalAmount::INPUT1 => Operators::INFERIOR_OR_EQUAL, - MatchForTotalAmount::INPUT2 => Operators::EQUAL + MatchForTotalAmount::CART_TOTAL => Operators::INFERIOR_OR_EQUAL, + MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL ); $values = array( - MatchForTotalAmount::INPUT1 => 400.00, - MatchForTotalAmount::INPUT2 => 'EUR'); + MatchForTotalAmount::CART_TOTAL => 400.00, + MatchForTotalAmount::CART_CURRENCY => 'EUR'); $condition1->setValidatorsFromForm($operators, $values); $isValid = $condition1->isMatching(); @@ -321,12 +321,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForTotalAmount($stubFacade); $operators = array( - MatchForTotalAmount::INPUT1 => Operators::INFERIOR_OR_EQUAL, - MatchForTotalAmount::INPUT2 => Operators::EQUAL + MatchForTotalAmount::CART_TOTAL => Operators::INFERIOR_OR_EQUAL, + MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL ); $values = array( - MatchForTotalAmount::INPUT1 => 400.00, - MatchForTotalAmount::INPUT2 => 'EUR'); + MatchForTotalAmount::CART_TOTAL => 400.00, + MatchForTotalAmount::CART_CURRENCY => 'EUR'); $condition1->setValidatorsFromForm($operators, $values); $isValid = $condition1->isMatching(); @@ -349,12 +349,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForTotalAmount($stubFacade); $operators = array( - MatchForTotalAmount::INPUT1 => Operators::EQUAL, - MatchForTotalAmount::INPUT2 => Operators::EQUAL + MatchForTotalAmount::CART_TOTAL => Operators::EQUAL, + MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL ); $values = array( - MatchForTotalAmount::INPUT1 => 400.00, - MatchForTotalAmount::INPUT2 => 'EUR'); + MatchForTotalAmount::CART_TOTAL => 400.00, + MatchForTotalAmount::CART_CURRENCY => 'EUR'); $condition1->setValidatorsFromForm($operators, $values); $isValid = $condition1->isMatching(); @@ -377,12 +377,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForTotalAmount($stubFacade); $operators = array( - MatchForTotalAmount::INPUT1 => Operators::EQUAL, - MatchForTotalAmount::INPUT2 => Operators::EQUAL + MatchForTotalAmount::CART_TOTAL => Operators::EQUAL, + MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL ); $values = array( - MatchForTotalAmount::INPUT1 => 400.00, - MatchForTotalAmount::INPUT2 => 'EUR'); + MatchForTotalAmount::CART_TOTAL => 400.00, + MatchForTotalAmount::CART_CURRENCY => 'EUR'); $condition1->setValidatorsFromForm($operators, $values); $isValid = $condition1->isMatching(); @@ -405,12 +405,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForTotalAmount($stubFacade); $operators = array( - MatchForTotalAmount::INPUT1 => Operators::SUPERIOR_OR_EQUAL, - MatchForTotalAmount::INPUT2 => Operators::EQUAL + MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR_OR_EQUAL, + MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL ); $values = array( - MatchForTotalAmount::INPUT1 => 400.00, - MatchForTotalAmount::INPUT2 => 'EUR'); + MatchForTotalAmount::CART_TOTAL => 400.00, + MatchForTotalAmount::CART_CURRENCY => 'EUR'); $condition1->setValidatorsFromForm($operators, $values); $isValid = $condition1->isMatching(); @@ -433,12 +433,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForTotalAmount($stubFacade); $operators = array( - MatchForTotalAmount::INPUT1 => Operators::SUPERIOR_OR_EQUAL, - MatchForTotalAmount::INPUT2 => Operators::EQUAL + MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR_OR_EQUAL, + MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL ); $values = array( - MatchForTotalAmount::INPUT1 => 400.00, - MatchForTotalAmount::INPUT2 => 'EUR'); + MatchForTotalAmount::CART_TOTAL => 400.00, + MatchForTotalAmount::CART_CURRENCY => 'EUR'); $condition1->setValidatorsFromForm($operators, $values); $isValid = $condition1->isMatching(); @@ -461,12 +461,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForTotalAmount($stubFacade); $operators = array( - MatchForTotalAmount::INPUT1 => Operators::SUPERIOR_OR_EQUAL, - MatchForTotalAmount::INPUT2 => Operators::EQUAL + MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR_OR_EQUAL, + MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL ); $values = array( - MatchForTotalAmount::INPUT1 => 400.00, - MatchForTotalAmount::INPUT2 => 'EUR'); + MatchForTotalAmount::CART_TOTAL => 400.00, + MatchForTotalAmount::CART_CURRENCY => 'EUR'); $condition1->setValidatorsFromForm($operators, $values); $isValid = $condition1->isMatching(); @@ -489,12 +489,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForTotalAmount($stubFacade); $operators = array( - MatchForTotalAmount::INPUT1 => Operators::SUPERIOR, - MatchForTotalAmount::INPUT2 => Operators::EQUAL + MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR, + MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL ); $values = array( - MatchForTotalAmount::INPUT1 => 400.00, - MatchForTotalAmount::INPUT2 => 'EUR'); + MatchForTotalAmount::CART_TOTAL => 400.00, + MatchForTotalAmount::CART_CURRENCY => 'EUR'); $condition1->setValidatorsFromForm($operators, $values); $isValid = $condition1->isMatching(); @@ -517,12 +517,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForTotalAmount($stubFacade); $operators = array( - MatchForTotalAmount::INPUT1 => Operators::SUPERIOR, - MatchForTotalAmount::INPUT2 => Operators::EQUAL + MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR, + MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL ); $values = array( - MatchForTotalAmount::INPUT1 => 400.00, - MatchForTotalAmount::INPUT2 => 'EUR'); + MatchForTotalAmount::CART_TOTAL => 400.00, + MatchForTotalAmount::CART_CURRENCY => 'EUR'); $condition1->setValidatorsFromForm($operators, $values); $isValid = $condition1->isMatching(); @@ -545,12 +545,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForTotalAmount($stubFacade); $operators = array( - MatchForTotalAmount::INPUT1 => Operators::EQUAL, - MatchForTotalAmount::INPUT2 => Operators::EQUAL + MatchForTotalAmount::CART_TOTAL => Operators::EQUAL, + MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL ); $values = array( - MatchForTotalAmount::INPUT1 => 400.00, - MatchForTotalAmount::INPUT2 => 'EUR'); + MatchForTotalAmount::CART_TOTAL => 400.00, + MatchForTotalAmount::CART_CURRENCY => 'EUR'); $condition1->setValidatorsFromForm($operators, $values); $isValid = $condition1->isMatching(); @@ -573,12 +573,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForTotalAmount($stubFacade); $operators = array( - MatchForTotalAmount::INPUT1 => Operators::EQUAL, - MatchForTotalAmount::INPUT2 => Operators::EQUAL + MatchForTotalAmount::CART_TOTAL => Operators::EQUAL, + MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL ); $values = array( - MatchForTotalAmount::INPUT1 => 400.00, - MatchForTotalAmount::INPUT2 => 'USD'); + MatchForTotalAmount::CART_TOTAL => 400.00, + MatchForTotalAmount::CART_CURRENCY => 'USD'); $condition1->setValidatorsFromForm($operators, $values); $isValid = $condition1->isMatching(); @@ -621,12 +621,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForTotalAmount($stubFacade); $operators = array( - MatchForTotalAmount::INPUT1 => Operators::EQUAL, - MatchForTotalAmount::INPUT2 => Operators::EQUAL + MatchForTotalAmount::CART_TOTAL => Operators::EQUAL, + MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL ); $values = array( - MatchForTotalAmount::INPUT1 => 400.00, - MatchForTotalAmount::INPUT2 => 'UNK'); + MatchForTotalAmount::CART_TOTAL => 400.00, + MatchForTotalAmount::CART_CURRENCY => 'UNK'); $condition1->setValidatorsFromForm($operators, $values); $stubContainer = $this->getMockBuilder('\Symfony\Component\DependencyInjection\Container') @@ -686,12 +686,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForTotalAmount($stubFacade); $operators = array( - MatchForTotalAmount::INPUT1 => Operators::EQUAL, - MatchForTotalAmount::INPUT2 => Operators::EQUAL + MatchForTotalAmount::CART_TOTAL => Operators::EQUAL, + MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL ); $values = array( - MatchForTotalAmount::INPUT1 => 'notfloat', - MatchForTotalAmount::INPUT2 => 'EUR'); + MatchForTotalAmount::CART_TOTAL => 'notfloat', + MatchForTotalAmount::CART_CURRENCY => 'EUR'); $condition1->setValidatorsFromForm($operators, $values); $stubContainer = $this->getMockBuilder('\Symfony\Component\DependencyInjection\Container') @@ -751,12 +751,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForTotalAmount($stubFacade); $operators = array( - MatchForTotalAmount::INPUT1 => Operators::EQUAL, - MatchForTotalAmount::INPUT2 => Operators::EQUAL + MatchForTotalAmount::CART_TOTAL => Operators::EQUAL, + MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL ); $values = array( - MatchForTotalAmount::INPUT1 => 0.00, - MatchForTotalAmount::INPUT2 => 'EUR'); + MatchForTotalAmount::CART_TOTAL => 0.00, + MatchForTotalAmount::CART_CURRENCY => 'EUR'); $condition1->setValidatorsFromForm($operators, $values); $stubContainer = $this->getMockBuilder('\Symfony\Component\DependencyInjection\Container') @@ -863,12 +863,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase /** @var FacadeInterface $stubFacade */ $condition1 = new MatchForTotalAmount($stubFacade); $operators = array( - MatchForTotalAmount::INPUT1 => Operators::EQUAL, - MatchForTotalAmount::INPUT2 => Operators::EQUAL + MatchForTotalAmount::CART_TOTAL => Operators::EQUAL, + MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL ); $values = array( - MatchForTotalAmount::INPUT1 => 400.00, - MatchForTotalAmount::INPUT2 => 'EUR'); + MatchForTotalAmount::CART_TOTAL => 400.00, + MatchForTotalAmount::CART_CURRENCY => 'EUR'); $condition1->setValidatorsFromForm($operators, $values); $actual = $condition1->getToolTip(); @@ -889,19 +889,19 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase /** @var FacadeInterface $stubFacade */ $condition1 = new MatchForTotalAmount($stubFacade); $operators = array( - MatchForTotalAmount::INPUT1 => Operators::EQUAL, - MatchForTotalAmount::INPUT2 => Operators::EQUAL + MatchForTotalAmount::CART_TOTAL => Operators::EQUAL, + MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL ); $values = array( - MatchForTotalAmount::INPUT1 => 400.00, - MatchForTotalAmount::INPUT2 => 'EUR'); + MatchForTotalAmount::CART_TOTAL => 400.00, + MatchForTotalAmount::CART_CURRENCY => 'EUR'); $condition1->setValidatorsFromForm($operators, $values); $actual = $condition1->getValidators(); $validators = array( 'inputs' => array( - MatchForTotalAmount::INPUT1 => array( + MatchForTotalAmount::CART_TOTAL => array( 'availableOperators' => array( '<' => 'Price', '<=' => 'Price', @@ -913,7 +913,7 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase 'value' => '', 'selectedOperator' => '' ), - MatchForTotalAmount::INPUT2 => array( + MatchForTotalAmount::CART_CURRENCY => array( 'availableOperators' => array('==' => 'Price'), 'availableValues' => array( 'EUR' => '€', diff --git a/core/lib/Thelia/Tests/Condition/Implementation/MatchForXArticlesTest.php b/core/lib/Thelia/Tests/Condition/Implementation/MatchForXArticlesTest.php index 3d96df4a2..c00f7a6ce 100644 --- a/core/lib/Thelia/Tests/Condition/Implementation/MatchForXArticlesTest.php +++ b/core/lib/Thelia/Tests/Condition/Implementation/MatchForXArticlesTest.php @@ -59,10 +59,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForXArticles($stubFacade); $operators = array( - MatchForXArticles::INPUT1 => Operators::IN + MatchForXArticles::CART_QUANTITY => Operators::IN ); $values = array( - MatchForXArticles::INPUT1 => 5 + MatchForXArticles::CART_QUANTITY => 5 ); $condition1->setValidatorsFromForm($operators, $values); @@ -95,10 +95,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForXArticles($stubFacade); $operators = array( - MatchForXArticles::INPUT1 => Operators::SUPERIOR + MatchForXArticles::CART_QUANTITY => Operators::SUPERIOR ); $values = array( - MatchForXArticles::INPUT1 => 'X' + MatchForXArticles::CART_QUANTITY => 'X' ); $condition1->setValidatorsFromForm($operators, $values); @@ -131,10 +131,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForXArticles($stubFacade); $operators = array( - MatchForXArticles::INPUT1 => Operators::INFERIOR + MatchForXArticles::CART_QUANTITY => Operators::INFERIOR ); $values = array( - MatchForXArticles::INPUT1 => 5 + MatchForXArticles::CART_QUANTITY => 5 ); $condition1->setValidatorsFromForm($operators, $values); @@ -167,10 +167,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForXArticles($stubFacade); $operators = array( - MatchForXArticles::INPUT1 => Operators::INFERIOR + MatchForXArticles::CART_QUANTITY => Operators::INFERIOR ); $values = array( - MatchForXArticles::INPUT1 => 4, + MatchForXArticles::CART_QUANTITY => 4, ); $condition1->setValidatorsFromForm($operators, $values); @@ -203,10 +203,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForXArticles($stubFacade); $operators = array( - MatchForXArticles::INPUT1 => Operators::INFERIOR_OR_EQUAL, + MatchForXArticles::CART_QUANTITY => Operators::INFERIOR_OR_EQUAL, ); $values = array( - MatchForXArticles::INPUT1 => 5, + MatchForXArticles::CART_QUANTITY => 5, ); $condition1->setValidatorsFromForm($operators, $values); @@ -239,10 +239,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForXArticles($stubFacade); $operators = array( - MatchForXArticles::INPUT1 => Operators::INFERIOR_OR_EQUAL + MatchForXArticles::CART_QUANTITY => Operators::INFERIOR_OR_EQUAL ); $values = array( - MatchForXArticles::INPUT1 => 4 + MatchForXArticles::CART_QUANTITY => 4 ); $condition1->setValidatorsFromForm($operators, $values); @@ -275,10 +275,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForXArticles($stubFacade); $operators = array( - MatchForXArticles::INPUT1 => Operators::INFERIOR_OR_EQUAL + MatchForXArticles::CART_QUANTITY => Operators::INFERIOR_OR_EQUAL ); $values = array( - MatchForXArticles::INPUT1 => 3 + MatchForXArticles::CART_QUANTITY => 3 ); $condition1->setValidatorsFromForm($operators, $values); @@ -311,10 +311,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForXArticles($stubFacade); $operators = array( - MatchForXArticles::INPUT1 => Operators::EQUAL + MatchForXArticles::CART_QUANTITY => Operators::EQUAL ); $values = array( - MatchForXArticles::INPUT1 => 4 + MatchForXArticles::CART_QUANTITY => 4 ); $condition1->setValidatorsFromForm($operators, $values); @@ -347,10 +347,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForXArticles($stubFacade); $operators = array( - MatchForXArticles::INPUT1 => Operators::EQUAL + MatchForXArticles::CART_QUANTITY => Operators::EQUAL ); $values = array( - MatchForXArticles::INPUT1 => 5 + MatchForXArticles::CART_QUANTITY => 5 ); $condition1->setValidatorsFromForm($operators, $values); @@ -383,10 +383,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForXArticles($stubFacade); $operators = array( - MatchForXArticles::INPUT1 => Operators::SUPERIOR_OR_EQUAL + MatchForXArticles::CART_QUANTITY => Operators::SUPERIOR_OR_EQUAL ); $values = array( - MatchForXArticles::INPUT1 => 4 + MatchForXArticles::CART_QUANTITY => 4 ); $condition1->setValidatorsFromForm($operators, $values); @@ -419,10 +419,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForXArticles($stubFacade); $operators = array( - MatchForXArticles::INPUT1 => Operators::SUPERIOR_OR_EQUAL + MatchForXArticles::CART_QUANTITY => Operators::SUPERIOR_OR_EQUAL ); $values = array( - MatchForXArticles::INPUT1 => 3 + MatchForXArticles::CART_QUANTITY => 3 ); $condition1->setValidatorsFromForm($operators, $values); @@ -455,10 +455,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForXArticles($stubFacade); $operators = array( - MatchForXArticles::INPUT1 => Operators::SUPERIOR_OR_EQUAL + MatchForXArticles::CART_QUANTITY => Operators::SUPERIOR_OR_EQUAL ); $values = array( - MatchForXArticles::INPUT1 => 5 + MatchForXArticles::CART_QUANTITY => 5 ); $condition1->setValidatorsFromForm($operators, $values); @@ -491,10 +491,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForXArticles($stubFacade); $operators = array( - MatchForXArticles::INPUT1 => Operators::SUPERIOR + MatchForXArticles::CART_QUANTITY => Operators::SUPERIOR ); $values = array( - MatchForXArticles::INPUT1 => 3 + MatchForXArticles::CART_QUANTITY => 3 ); $condition1->setValidatorsFromForm($operators, $values); @@ -527,10 +527,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForXArticles($stubFacade); $operators = array( - MatchForXArticles::INPUT1 => Operators::SUPERIOR + MatchForXArticles::CART_QUANTITY => Operators::SUPERIOR ); $values = array( - MatchForXArticles::INPUT1 => 4 + MatchForXArticles::CART_QUANTITY => 4 ); $condition1->setValidatorsFromForm($operators, $values); @@ -557,10 +557,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase $condition1 = new MatchForXArticles($stubFacade); $operators = array( - MatchForXArticles::INPUT1 => Operators::SUPERIOR + MatchForXArticles::CART_QUANTITY => Operators::SUPERIOR ); $values = array( - MatchForXArticles::INPUT1 => 4 + MatchForXArticles::CART_QUANTITY => 4 ); $condition1->setValidatorsFromForm($operators, $values); @@ -577,44 +577,6 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase } - public function testGetAvailableOperators() - { - /** @var FacadeInterface $stubFacade */ - $stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade') - ->disableOriginalConstructor() - ->getMock(); - - $stubFacade->expects($this->any()) - ->method('getNbArticlesInCart') - ->will($this->returnValue(4)); - $stubFacade->expects($this->any()) - ->method('getConditionEvaluator') - ->will($this->returnValue(new ConditionEvaluator())); - - $condition1 = new MatchForXArticles($stubFacade); - $operators = array( - MatchForXArticles::INPUT1 => Operators::SUPERIOR - ); - $values = array( - MatchForXArticles::INPUT1 => 4 - ); - $condition1->setValidatorsFromForm($operators, $values); - - $expected = array( - MatchForXArticles::INPUT1 => array( - Operators::INFERIOR, - Operators::INFERIOR_OR_EQUAL, - Operators::EQUAL, - Operators::SUPERIOR_OR_EQUAL, - Operators::SUPERIOR - ) - ); - $actual = $condition1->getAvailableOperators(); - - $this->assertEquals($expected, $actual); - - } - /** * Generate adapter stub * @@ -687,10 +649,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase /** @var FacadeInterface $stubFacade */ $condition1 = new MatchForXArticles($stubFacade); $operators = array( - MatchForXArticles::INPUT1 => Operators::SUPERIOR + MatchForXArticles::CART_QUANTITY => Operators::SUPERIOR ); $values = array( - MatchForXArticles::INPUT1 => 4 + MatchForXArticles::CART_QUANTITY => 4 ); $condition1->setValidatorsFromForm($operators, $values); @@ -712,10 +674,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase /** @var FacadeInterface $stubFacade */ $condition1 = new MatchForXArticles($stubFacade); $operators = array( - MatchForXArticles::INPUT1 => Operators::SUPERIOR + MatchForXArticles::CART_QUANTITY => Operators::SUPERIOR ); $values = array( - MatchForXArticles::INPUT1 => 4 + MatchForXArticles::CART_QUANTITY => 4 ); $condition1->setValidatorsFromForm($operators, $values); @@ -723,7 +685,7 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase $validators = array( 'inputs' => array( - MatchForXArticles::INPUT1 => array( + MatchForXArticles::CART_QUANTITY => array( 'availableOperators' => array( '<' => 'Price', '<=' => 'Price',