Changed condition parameter name

This commit is contained in:
Franck Allimant
2014-05-10 01:36:11 +02:00
parent 861e6b0513
commit 2aa8d804b0
4 changed files with 165 additions and 203 deletions

View File

@@ -101,12 +101,12 @@ class ConditionCollectionTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade); $condition1 = new MatchForTotalAmount($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmount::INPUT1 => Operators::EQUAL, MatchForTotalAmount::CART_TOTAL => Operators::EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
); );
$values = array( $values = array(
MatchForTotalAmount::INPUT1 => 400, MatchForTotalAmount::CART_TOTAL => 400,
MatchForTotalAmount::INPUT2 => 'EUR'); MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
$collection = new ConditionCollection(); $collection = new ConditionCollection();
@@ -138,22 +138,22 @@ class ConditionCollectionTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade); $condition1 = new MatchForTotalAmount($stubFacade);
$operators1 = array( $operators1 = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR, MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
); );
$values1 = array( $values1 = array(
MatchForTotalAmount::INPUT1 => 400, MatchForTotalAmount::CART_TOTAL => 400,
MatchForTotalAmount::INPUT2 => 'EUR'); MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators1, $values1); $condition1->setValidatorsFromForm($operators1, $values1);
$condition2 = new MatchForTotalAmount($stubFacade); $condition2 = new MatchForTotalAmount($stubFacade);
$operators2 = array( $operators2 = array(
MatchForTotalAmount::INPUT1 => Operators::INFERIOR, MatchForTotalAmount::CART_TOTAL => Operators::INFERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
); );
$values2 = array( $values2 = array(
MatchForTotalAmount::INPUT1 => 600, MatchForTotalAmount::CART_TOTAL => 600,
MatchForTotalAmount::INPUT2 => 'EUR'); MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition2->setValidatorsFromForm($operators2, $values2); $condition2->setValidatorsFromForm($operators2, $values2);
$collection = new ConditionCollection(); $collection = new ConditionCollection();

View File

@@ -81,12 +81,12 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade); $condition1 = new MatchForTotalAmount($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR, MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
); );
$values = array( $values = array(
MatchForTotalAmount::INPUT1 => 40.00, MatchForTotalAmount::CART_TOTAL => 40.00,
MatchForTotalAmount::INPUT2 => 'EUR' MatchForTotalAmount::CART_CURRENCY => 'EUR'
); );
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
@@ -145,12 +145,12 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade); $condition1 = new MatchForTotalAmount($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR, MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
); );
$values = array( $values = array(
MatchForTotalAmount::INPUT1 => 40.00, MatchForTotalAmount::CART_TOTAL => 40.00,
MatchForTotalAmount::INPUT2 => 'EUR' MatchForTotalAmount::CART_CURRENCY => 'EUR'
); );
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
@@ -207,23 +207,23 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade); $condition1 = new MatchForTotalAmount($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR, MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
); );
$values = array( $values = array(
MatchForTotalAmount::INPUT1 => 40.00, MatchForTotalAmount::CART_TOTAL => 40.00,
MatchForTotalAmount::INPUT2 => 'EUR' MatchForTotalAmount::CART_CURRENCY => 'EUR'
); );
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
$condition2 = new MatchForTotalAmount($stubFacade); $condition2 = new MatchForTotalAmount($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR, MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
); );
$values = array( $values = array(
MatchForTotalAmount::INPUT1 => 400.00, MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR' MatchForTotalAmount::CART_CURRENCY => 'EUR'
); );
$condition2->setValidatorsFromForm($operators, $values); $condition2->setValidatorsFromForm($operators, $values);
@@ -286,12 +286,12 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
->will($this->returnValue($stubContainer)); ->will($this->returnValue($stubContainer));
$operators = array( $operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR, MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
); );
$values = array( $values = array(
MatchForTotalAmount::INPUT1 => 40.00, MatchForTotalAmount::CART_TOTAL => 40.00,
MatchForTotalAmount::INPUT2 => 'EUR' MatchForTotalAmount::CART_CURRENCY => 'EUR'
); );
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
@@ -351,12 +351,12 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
->will($this->returnValue($stubContainer)); ->will($this->returnValue($stubContainer));
$operators = array( $operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR, MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
); );
$values = array( $values = array(
MatchForTotalAmount::INPUT1 => 40.00, MatchForTotalAmount::CART_TOTAL => 40.00,
MatchForTotalAmount::INPUT2 => 'EUR' MatchForTotalAmount::CART_CURRENCY => 'EUR'
); );
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);

View File

@@ -94,12 +94,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
/** @var FacadeInterface $stubFacade */ /** @var FacadeInterface $stubFacade */
$condition1 = new MatchForTotalAmount($stubFacade); $condition1 = new MatchForTotalAmount($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmount::INPUT1 => Operators::IN, MatchForTotalAmount::CART_TOTAL => Operators::IN,
MatchForTotalAmount::INPUT2 => Operators::EQUAL MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
); );
$values = array( $values = array(
MatchForTotalAmount::INPUT1 => '400', MatchForTotalAmount::CART_TOTAL => '400',
MatchForTotalAmount::INPUT2 => 'EUR'); MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching(); $isValid = $condition1->isMatching();
@@ -123,12 +123,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
/** @var FacadeInterface $stubFacade */ /** @var FacadeInterface $stubFacade */
$condition1 = new MatchForTotalAmount($stubFacade); $condition1 = new MatchForTotalAmount($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR, MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::INFERIOR MatchForTotalAmount::CART_CURRENCY => Operators::INFERIOR
); );
$values = array( $values = array(
MatchForTotalAmount::INPUT1 => '400', MatchForTotalAmount::CART_TOTAL => '400',
MatchForTotalAmount::INPUT2 => 'EUR'); MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching(); $isValid = $condition1->isMatching();
@@ -152,12 +152,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade); $condition1 = new MatchForTotalAmount($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR, MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
); );
$values = array( $values = array(
MatchForTotalAmount::INPUT1 => 'X', MatchForTotalAmount::CART_TOTAL => 'X',
MatchForTotalAmount::INPUT2 => 'EUR'); MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching(); $isValid = $condition1->isMatching();
@@ -181,12 +181,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade); $condition1 = new MatchForTotalAmount($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR, MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
); );
$values = array( $values = array(
MatchForTotalAmount::INPUT1 => 400, MatchForTotalAmount::CART_TOTAL => 400,
MatchForTotalAmount::INPUT2 => 'FLA'); MatchForTotalAmount::CART_CURRENCY => 'FLA');
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching(); $isValid = $condition1->isMatching();
@@ -209,12 +209,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade); $condition1 = new MatchForTotalAmount($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmount::INPUT1 => Operators::INFERIOR, MatchForTotalAmount::CART_TOTAL => Operators::INFERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
); );
$values = array( $values = array(
MatchForTotalAmount::INPUT1 => 400.00, MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR'); MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching(); $isValid = $condition1->isMatching();
@@ -237,12 +237,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade); $condition1 = new MatchForTotalAmount($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmount::INPUT1 => Operators::INFERIOR, MatchForTotalAmount::CART_TOTAL => Operators::INFERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
); );
$values = array( $values = array(
MatchForTotalAmount::INPUT1 => 400.00, MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR'); MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching(); $isValid = $condition1->isMatching();
@@ -265,12 +265,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade); $condition1 = new MatchForTotalAmount($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmount::INPUT1 => Operators::INFERIOR_OR_EQUAL, MatchForTotalAmount::CART_TOTAL => Operators::INFERIOR_OR_EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
); );
$values = array( $values = array(
MatchForTotalAmount::INPUT1 => 400.00, MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR'); MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching(); $isValid = $condition1->isMatching();
@@ -293,12 +293,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade); $condition1 = new MatchForTotalAmount($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmount::INPUT1 => Operators::INFERIOR_OR_EQUAL, MatchForTotalAmount::CART_TOTAL => Operators::INFERIOR_OR_EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
); );
$values = array( $values = array(
MatchForTotalAmount::INPUT1 => 400.00, MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR'); MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching(); $isValid = $condition1->isMatching();
@@ -321,12 +321,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade); $condition1 = new MatchForTotalAmount($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmount::INPUT1 => Operators::INFERIOR_OR_EQUAL, MatchForTotalAmount::CART_TOTAL => Operators::INFERIOR_OR_EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
); );
$values = array( $values = array(
MatchForTotalAmount::INPUT1 => 400.00, MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR'); MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching(); $isValid = $condition1->isMatching();
@@ -349,12 +349,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade); $condition1 = new MatchForTotalAmount($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmount::INPUT1 => Operators::EQUAL, MatchForTotalAmount::CART_TOTAL => Operators::EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
); );
$values = array( $values = array(
MatchForTotalAmount::INPUT1 => 400.00, MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR'); MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching(); $isValid = $condition1->isMatching();
@@ -377,12 +377,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade); $condition1 = new MatchForTotalAmount($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmount::INPUT1 => Operators::EQUAL, MatchForTotalAmount::CART_TOTAL => Operators::EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
); );
$values = array( $values = array(
MatchForTotalAmount::INPUT1 => 400.00, MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR'); MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching(); $isValid = $condition1->isMatching();
@@ -405,12 +405,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade); $condition1 = new MatchForTotalAmount($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR_OR_EQUAL, MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR_OR_EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
); );
$values = array( $values = array(
MatchForTotalAmount::INPUT1 => 400.00, MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR'); MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching(); $isValid = $condition1->isMatching();
@@ -433,12 +433,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade); $condition1 = new MatchForTotalAmount($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR_OR_EQUAL, MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR_OR_EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
); );
$values = array( $values = array(
MatchForTotalAmount::INPUT1 => 400.00, MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR'); MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching(); $isValid = $condition1->isMatching();
@@ -461,12 +461,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade); $condition1 = new MatchForTotalAmount($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR_OR_EQUAL, MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR_OR_EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
); );
$values = array( $values = array(
MatchForTotalAmount::INPUT1 => 400.00, MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR'); MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching(); $isValid = $condition1->isMatching();
@@ -489,12 +489,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade); $condition1 = new MatchForTotalAmount($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR, MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
); );
$values = array( $values = array(
MatchForTotalAmount::INPUT1 => 400.00, MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR'); MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching(); $isValid = $condition1->isMatching();
@@ -517,12 +517,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade); $condition1 = new MatchForTotalAmount($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR, MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
); );
$values = array( $values = array(
MatchForTotalAmount::INPUT1 => 400.00, MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR'); MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching(); $isValid = $condition1->isMatching();
@@ -545,12 +545,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade); $condition1 = new MatchForTotalAmount($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmount::INPUT1 => Operators::EQUAL, MatchForTotalAmount::CART_TOTAL => Operators::EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
); );
$values = array( $values = array(
MatchForTotalAmount::INPUT1 => 400.00, MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR'); MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching(); $isValid = $condition1->isMatching();
@@ -573,12 +573,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade); $condition1 = new MatchForTotalAmount($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmount::INPUT1 => Operators::EQUAL, MatchForTotalAmount::CART_TOTAL => Operators::EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
); );
$values = array( $values = array(
MatchForTotalAmount::INPUT1 => 400.00, MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::INPUT2 => 'USD'); MatchForTotalAmount::CART_CURRENCY => 'USD');
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching(); $isValid = $condition1->isMatching();
@@ -621,12 +621,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade); $condition1 = new MatchForTotalAmount($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmount::INPUT1 => Operators::EQUAL, MatchForTotalAmount::CART_TOTAL => Operators::EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
); );
$values = array( $values = array(
MatchForTotalAmount::INPUT1 => 400.00, MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::INPUT2 => 'UNK'); MatchForTotalAmount::CART_CURRENCY => 'UNK');
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
$stubContainer = $this->getMockBuilder('\Symfony\Component\DependencyInjection\Container') $stubContainer = $this->getMockBuilder('\Symfony\Component\DependencyInjection\Container')
@@ -686,12 +686,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade); $condition1 = new MatchForTotalAmount($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmount::INPUT1 => Operators::EQUAL, MatchForTotalAmount::CART_TOTAL => Operators::EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
); );
$values = array( $values = array(
MatchForTotalAmount::INPUT1 => 'notfloat', MatchForTotalAmount::CART_TOTAL => 'notfloat',
MatchForTotalAmount::INPUT2 => 'EUR'); MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
$stubContainer = $this->getMockBuilder('\Symfony\Component\DependencyInjection\Container') $stubContainer = $this->getMockBuilder('\Symfony\Component\DependencyInjection\Container')
@@ -751,12 +751,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade); $condition1 = new MatchForTotalAmount($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmount::INPUT1 => Operators::EQUAL, MatchForTotalAmount::CART_TOTAL => Operators::EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
); );
$values = array( $values = array(
MatchForTotalAmount::INPUT1 => 0.00, MatchForTotalAmount::CART_TOTAL => 0.00,
MatchForTotalAmount::INPUT2 => 'EUR'); MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
$stubContainer = $this->getMockBuilder('\Symfony\Component\DependencyInjection\Container') $stubContainer = $this->getMockBuilder('\Symfony\Component\DependencyInjection\Container')
@@ -863,12 +863,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
/** @var FacadeInterface $stubFacade */ /** @var FacadeInterface $stubFacade */
$condition1 = new MatchForTotalAmount($stubFacade); $condition1 = new MatchForTotalAmount($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmount::INPUT1 => Operators::EQUAL, MatchForTotalAmount::CART_TOTAL => Operators::EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
); );
$values = array( $values = array(
MatchForTotalAmount::INPUT1 => 400.00, MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR'); MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
$actual = $condition1->getToolTip(); $actual = $condition1->getToolTip();
@@ -889,19 +889,19 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
/** @var FacadeInterface $stubFacade */ /** @var FacadeInterface $stubFacade */
$condition1 = new MatchForTotalAmount($stubFacade); $condition1 = new MatchForTotalAmount($stubFacade);
$operators = array( $operators = array(
MatchForTotalAmount::INPUT1 => Operators::EQUAL, MatchForTotalAmount::CART_TOTAL => Operators::EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
); );
$values = array( $values = array(
MatchForTotalAmount::INPUT1 => 400.00, MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR'); MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
$actual = $condition1->getValidators(); $actual = $condition1->getValidators();
$validators = array( $validators = array(
'inputs' => array( 'inputs' => array(
MatchForTotalAmount::INPUT1 => array( MatchForTotalAmount::CART_TOTAL => array(
'availableOperators' => array( 'availableOperators' => array(
'<' => 'Price', '<' => 'Price',
'<=' => 'Price', '<=' => 'Price',
@@ -913,7 +913,7 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
'value' => '', 'value' => '',
'selectedOperator' => '' 'selectedOperator' => ''
), ),
MatchForTotalAmount::INPUT2 => array( MatchForTotalAmount::CART_CURRENCY => array(
'availableOperators' => array('==' => 'Price'), 'availableOperators' => array('==' => 'Price'),
'availableValues' => array( 'availableValues' => array(
'EUR' => '€', 'EUR' => '€',

View File

@@ -59,10 +59,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForXArticles($stubFacade); $condition1 = new MatchForXArticles($stubFacade);
$operators = array( $operators = array(
MatchForXArticles::INPUT1 => Operators::IN MatchForXArticles::CART_QUANTITY => Operators::IN
); );
$values = array( $values = array(
MatchForXArticles::INPUT1 => 5 MatchForXArticles::CART_QUANTITY => 5
); );
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
@@ -95,10 +95,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForXArticles($stubFacade); $condition1 = new MatchForXArticles($stubFacade);
$operators = array( $operators = array(
MatchForXArticles::INPUT1 => Operators::SUPERIOR MatchForXArticles::CART_QUANTITY => Operators::SUPERIOR
); );
$values = array( $values = array(
MatchForXArticles::INPUT1 => 'X' MatchForXArticles::CART_QUANTITY => 'X'
); );
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
@@ -131,10 +131,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForXArticles($stubFacade); $condition1 = new MatchForXArticles($stubFacade);
$operators = array( $operators = array(
MatchForXArticles::INPUT1 => Operators::INFERIOR MatchForXArticles::CART_QUANTITY => Operators::INFERIOR
); );
$values = array( $values = array(
MatchForXArticles::INPUT1 => 5 MatchForXArticles::CART_QUANTITY => 5
); );
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
@@ -167,10 +167,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForXArticles($stubFacade); $condition1 = new MatchForXArticles($stubFacade);
$operators = array( $operators = array(
MatchForXArticles::INPUT1 => Operators::INFERIOR MatchForXArticles::CART_QUANTITY => Operators::INFERIOR
); );
$values = array( $values = array(
MatchForXArticles::INPUT1 => 4, MatchForXArticles::CART_QUANTITY => 4,
); );
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
@@ -203,10 +203,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForXArticles($stubFacade); $condition1 = new MatchForXArticles($stubFacade);
$operators = array( $operators = array(
MatchForXArticles::INPUT1 => Operators::INFERIOR_OR_EQUAL, MatchForXArticles::CART_QUANTITY => Operators::INFERIOR_OR_EQUAL,
); );
$values = array( $values = array(
MatchForXArticles::INPUT1 => 5, MatchForXArticles::CART_QUANTITY => 5,
); );
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
@@ -239,10 +239,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForXArticles($stubFacade); $condition1 = new MatchForXArticles($stubFacade);
$operators = array( $operators = array(
MatchForXArticles::INPUT1 => Operators::INFERIOR_OR_EQUAL MatchForXArticles::CART_QUANTITY => Operators::INFERIOR_OR_EQUAL
); );
$values = array( $values = array(
MatchForXArticles::INPUT1 => 4 MatchForXArticles::CART_QUANTITY => 4
); );
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
@@ -275,10 +275,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForXArticles($stubFacade); $condition1 = new MatchForXArticles($stubFacade);
$operators = array( $operators = array(
MatchForXArticles::INPUT1 => Operators::INFERIOR_OR_EQUAL MatchForXArticles::CART_QUANTITY => Operators::INFERIOR_OR_EQUAL
); );
$values = array( $values = array(
MatchForXArticles::INPUT1 => 3 MatchForXArticles::CART_QUANTITY => 3
); );
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
@@ -311,10 +311,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForXArticles($stubFacade); $condition1 = new MatchForXArticles($stubFacade);
$operators = array( $operators = array(
MatchForXArticles::INPUT1 => Operators::EQUAL MatchForXArticles::CART_QUANTITY => Operators::EQUAL
); );
$values = array( $values = array(
MatchForXArticles::INPUT1 => 4 MatchForXArticles::CART_QUANTITY => 4
); );
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
@@ -347,10 +347,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForXArticles($stubFacade); $condition1 = new MatchForXArticles($stubFacade);
$operators = array( $operators = array(
MatchForXArticles::INPUT1 => Operators::EQUAL MatchForXArticles::CART_QUANTITY => Operators::EQUAL
); );
$values = array( $values = array(
MatchForXArticles::INPUT1 => 5 MatchForXArticles::CART_QUANTITY => 5
); );
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
@@ -383,10 +383,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForXArticles($stubFacade); $condition1 = new MatchForXArticles($stubFacade);
$operators = array( $operators = array(
MatchForXArticles::INPUT1 => Operators::SUPERIOR_OR_EQUAL MatchForXArticles::CART_QUANTITY => Operators::SUPERIOR_OR_EQUAL
); );
$values = array( $values = array(
MatchForXArticles::INPUT1 => 4 MatchForXArticles::CART_QUANTITY => 4
); );
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
@@ -419,10 +419,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForXArticles($stubFacade); $condition1 = new MatchForXArticles($stubFacade);
$operators = array( $operators = array(
MatchForXArticles::INPUT1 => Operators::SUPERIOR_OR_EQUAL MatchForXArticles::CART_QUANTITY => Operators::SUPERIOR_OR_EQUAL
); );
$values = array( $values = array(
MatchForXArticles::INPUT1 => 3 MatchForXArticles::CART_QUANTITY => 3
); );
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
@@ -455,10 +455,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForXArticles($stubFacade); $condition1 = new MatchForXArticles($stubFacade);
$operators = array( $operators = array(
MatchForXArticles::INPUT1 => Operators::SUPERIOR_OR_EQUAL MatchForXArticles::CART_QUANTITY => Operators::SUPERIOR_OR_EQUAL
); );
$values = array( $values = array(
MatchForXArticles::INPUT1 => 5 MatchForXArticles::CART_QUANTITY => 5
); );
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
@@ -491,10 +491,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForXArticles($stubFacade); $condition1 = new MatchForXArticles($stubFacade);
$operators = array( $operators = array(
MatchForXArticles::INPUT1 => Operators::SUPERIOR MatchForXArticles::CART_QUANTITY => Operators::SUPERIOR
); );
$values = array( $values = array(
MatchForXArticles::INPUT1 => 3 MatchForXArticles::CART_QUANTITY => 3
); );
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
@@ -527,10 +527,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForXArticles($stubFacade); $condition1 = new MatchForXArticles($stubFacade);
$operators = array( $operators = array(
MatchForXArticles::INPUT1 => Operators::SUPERIOR MatchForXArticles::CART_QUANTITY => Operators::SUPERIOR
); );
$values = array( $values = array(
MatchForXArticles::INPUT1 => 4 MatchForXArticles::CART_QUANTITY => 4
); );
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
@@ -557,10 +557,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForXArticles($stubFacade); $condition1 = new MatchForXArticles($stubFacade);
$operators = array( $operators = array(
MatchForXArticles::INPUT1 => Operators::SUPERIOR MatchForXArticles::CART_QUANTITY => Operators::SUPERIOR
); );
$values = array( $values = array(
MatchForXArticles::INPUT1 => 4 MatchForXArticles::CART_QUANTITY => 4
); );
$condition1->setValidatorsFromForm($operators, $values); $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 * Generate adapter stub
* *
@@ -687,10 +649,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
/** @var FacadeInterface $stubFacade */ /** @var FacadeInterface $stubFacade */
$condition1 = new MatchForXArticles($stubFacade); $condition1 = new MatchForXArticles($stubFacade);
$operators = array( $operators = array(
MatchForXArticles::INPUT1 => Operators::SUPERIOR MatchForXArticles::CART_QUANTITY => Operators::SUPERIOR
); );
$values = array( $values = array(
MatchForXArticles::INPUT1 => 4 MatchForXArticles::CART_QUANTITY => 4
); );
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
@@ -712,10 +674,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
/** @var FacadeInterface $stubFacade */ /** @var FacadeInterface $stubFacade */
$condition1 = new MatchForXArticles($stubFacade); $condition1 = new MatchForXArticles($stubFacade);
$operators = array( $operators = array(
MatchForXArticles::INPUT1 => Operators::SUPERIOR MatchForXArticles::CART_QUANTITY => Operators::SUPERIOR
); );
$values = array( $values = array(
MatchForXArticles::INPUT1 => 4 MatchForXArticles::CART_QUANTITY => 4
); );
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
@@ -723,7 +685,7 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
$validators = array( $validators = array(
'inputs' => array( 'inputs' => array(
MatchForXArticles::INPUT1 => array( MatchForXArticles::CART_QUANTITY => array(
'availableOperators' => array( 'availableOperators' => array(
'<' => 'Price', '<' => 'Price',
'<=' => 'Price', '<=' => 'Price',