Working : Coupon : Fix unit tests @todo refactor

This commit is contained in:
gmorel
2013-09-16 11:26:37 +02:00
parent d4d876c783
commit c49bfa4b25
5 changed files with 104 additions and 2 deletions

View File

@@ -65,6 +65,9 @@ class ConstraintValidatorTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any())
->method('getCheckoutCurrency')
->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue($ConstraintValidator));
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array(
@@ -99,6 +102,9 @@ class ConstraintValidatorTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any())
->method('getCheckoutCurrency')
->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue($ConstraintValidator));
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array(
@@ -136,6 +142,9 @@ class ConstraintValidatorTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any())
->method('getNbArticlesInCart')
->will($this->returnValue(5));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue($ConstraintValidator));
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array(
@@ -183,6 +192,9 @@ class ConstraintValidatorTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any())
->method('getNbArticlesInCart')
->will($this->returnValue(5));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue($ConstraintValidator));
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array(

View File

@@ -23,6 +23,7 @@
namespace Thelia\Coupon;
use Thelia\Constraint\ConstraintValidator;
use Thelia\Constraint\Rule\AvailableForTotalAmountManager;
use Thelia\Constraint\Rule\Operators;
@@ -169,6 +170,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any())
->method('getCheckoutCurrency')
->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array(
@@ -205,6 +209,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any())
->method('getCheckoutCurrency')
->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array(
@@ -241,6 +248,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any())
->method('getCheckoutCurrency')
->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array(
@@ -277,6 +287,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any())
->method('getCheckoutCurrency')
->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array(
@@ -313,6 +326,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any())
->method('getCheckoutCurrency')
->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array(
@@ -349,6 +365,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any())
->method('getCheckoutCurrency')
->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array(
@@ -385,6 +404,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any())
->method('getCheckoutCurrency')
->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array(
@@ -421,6 +443,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any())
->method('getCheckoutCurrency')
->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array(
@@ -457,6 +482,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any())
->method('getCheckoutCurrency')
->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array(
@@ -493,6 +521,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any())
->method('getCheckoutCurrency')
->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array(
@@ -529,6 +560,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any())
->method('getCheckoutCurrency')
->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array(
@@ -565,6 +599,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any())
->method('getCheckoutCurrency')
->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array(
@@ -601,6 +638,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any())
->method('getCheckoutCurrency')
->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array(
@@ -637,6 +677,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any())
->method('getCheckoutCurrency')
->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array(

View File

@@ -23,6 +23,7 @@
namespace Thelia\Coupon;
use Thelia\Constraint\ConstraintValidator;
use Thelia\Constraint\Rule\AvailableForXArticlesManager;
use Thelia\Constraint\Rule\Operators;
use Thelia\Constraint\Rule\SerializableRule;
@@ -192,6 +193,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any())
->method('getNbArticlesInCart')
->will($this->returnValue(4));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForXArticlesManager($stubAdapter);
$operators = array(
@@ -224,6 +228,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any())
->method('getNbArticlesInCart')
->will($this->returnValue(4));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForXArticlesManager($stubAdapter);
$operators = array(
@@ -256,6 +263,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any())
->method('getNbArticlesInCart')
->will($this->returnValue(4));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForXArticlesManager($stubAdapter);
$operators = array(
@@ -288,6 +298,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any())
->method('getNbArticlesInCart')
->will($this->returnValue(4));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForXArticlesManager($stubAdapter);
$operators = array(
@@ -320,6 +333,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any())
->method('getNbArticlesInCart')
->will($this->returnValue(4));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForXArticlesManager($stubAdapter);
$operators = array(
@@ -352,6 +368,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any())
->method('getNbArticlesInCart')
->will($this->returnValue(4));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForXArticlesManager($stubAdapter);
$operators = array(
@@ -384,6 +403,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any())
->method('getNbArticlesInCart')
->will($this->returnValue(4));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForXArticlesManager($stubAdapter);
$operators = array(
@@ -416,6 +438,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any())
->method('getNbArticlesInCart')
->will($this->returnValue(4));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForXArticlesManager($stubAdapter);
$operators = array(
@@ -448,6 +473,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any())
->method('getNbArticlesInCart')
->will($this->returnValue(4));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForXArticlesManager($stubAdapter);
$operators = array(
@@ -480,6 +508,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any())
->method('getNbArticlesInCart')
->will($this->returnValue(4));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForXArticlesManager($stubAdapter);
$operators = array(
@@ -512,6 +543,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any())
->method('getNbArticlesInCart')
->will($this->returnValue(4));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForXArticlesManager($stubAdapter);
$operators = array(
@@ -544,6 +578,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any())
->method('getNbArticlesInCart')
->will($this->returnValue(4));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForXArticlesManager($stubAdapter);
$operators = array(
@@ -570,6 +607,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any())
->method('getNbArticlesInCart')
->will($this->returnValue(4));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForXArticlesManager($stubAdapter);
$operators = array(
@@ -602,6 +642,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any())
->method('getNbArticlesInCart')
->will($this->returnValue(4));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForXArticlesManager($stubAdapter);
$operators = array(