Refactor removing Manager notion

This commit is contained in:
gmorel
2013-11-23 20:18:04 +01:00
parent 8ce1030178
commit 90b5fbde05
34 changed files with 442 additions and 411 deletions

View File

@@ -22,7 +22,7 @@
/**********************************************************************************/
namespace Thelia\Condition;
use Thelia\Condition\Implementation\MatchForTotalAmountManager;
use Thelia\Condition\Implementation\MatchForTotalAmount;
use Thelia\Model\CurrencyQuery;
/**
@@ -116,14 +116,14 @@ class ConditionCollectionTest extends \PHPUnit_Framework_TestCase
{
$stubFacade = $this->generateFacadeStub();
$condition1 = new MatchForTotalAmountManager($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::EQUAL,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
MatchForTotalAmount::INPUT1 => Operators::EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values = array(
MatchForTotalAmountManager::INPUT1 => 400,
MatchForTotalAmountManager::INPUT2 => 'EUR');
MatchForTotalAmount::INPUT1 => 400,
MatchForTotalAmount::INPUT2 => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$collection = new ConditionCollection();
@@ -153,24 +153,24 @@ class ConditionCollectionTest extends \PHPUnit_Framework_TestCase
{
$stubFacade = $this->generateFacadeStub();
$condition1 = new MatchForTotalAmountManager($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators1 = array(
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values1 = array(
MatchForTotalAmountManager::INPUT1 => 400,
MatchForTotalAmountManager::INPUT2 => 'EUR');
MatchForTotalAmount::INPUT1 => 400,
MatchForTotalAmount::INPUT2 => 'EUR');
$condition1->setValidatorsFromForm($operators1, $values1);
$condition2 = new MatchForTotalAmountManager($stubFacade);
$condition2 = new MatchForTotalAmount($stubFacade);
$operators2 = array(
MatchForTotalAmountManager::INPUT1 => Operators::INFERIOR,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
MatchForTotalAmount::INPUT1 => Operators::INFERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values2 = array(
MatchForTotalAmountManager::INPUT1 => 600,
MatchForTotalAmountManager::INPUT2 => 'EUR');
MatchForTotalAmount::INPUT1 => 600,
MatchForTotalAmount::INPUT2 => 'EUR');
$condition2->setValidatorsFromForm($operators2, $values2);
$collection = new ConditionCollection();

View File

@@ -146,14 +146,14 @@ class ConditionEvaluatorTest extends \PHPUnit_Framework_TestCase
*/
public function testIsMatchingTrue()
{
$stubConditionTrue1 = $this->getMockBuilder('\Thelia\Condition\Implementation\MatchForXArticlesManager')
$stubConditionTrue1 = $this->getMockBuilder('\Thelia\Condition\Implementation\MatchForXArticles')
->disableOriginalConstructor()
->getMock();
$stubConditionTrue1->expects($this->any())
->method('isMatching')
->will($this->returnValue(true));
$stubConditionTrue2 = $this->getMockBuilder('\Thelia\Condition\Implementation\MatchForXArticlesManager')
$stubConditionTrue2 = $this->getMockBuilder('\Thelia\Condition\Implementation\MatchForXArticles')
->disableOriginalConstructor()
->getMock();
$stubConditionTrue2->expects($this->any())
@@ -177,14 +177,14 @@ class ConditionEvaluatorTest extends \PHPUnit_Framework_TestCase
*/
public function testIsMatchingFalse()
{
$stubConditionTrue = $this->getMockBuilder('\Thelia\Condition\Implementation\MatchForXArticlesManager')
$stubConditionTrue = $this->getMockBuilder('\Thelia\Condition\Implementation\MatchForXArticles')
->disableOriginalConstructor()
->getMock();
$stubConditionTrue->expects($this->any())
->method('isMatching')
->will($this->returnValue(true));
$stubConditionFalse = $this->getMockBuilder('\Thelia\Condition\Implementation\MatchForXArticlesManager')
$stubConditionFalse = $this->getMockBuilder('\Thelia\Condition\Implementation\MatchForXArticles')
->disableOriginalConstructor()
->getMock();
$stubConditionFalse->expects($this->any())

View File

@@ -84,7 +84,7 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
->getMock();
$stubContainer->expects($this->any())
->method('get')
->will($this->returnValue(new MatchForTotalAmountManager($stubFacade)));
->will($this->returnValue(new MatchForTotalAmount($stubFacade)));
$stubContainer->expects($this->any())
->method('has')
@@ -94,14 +94,14 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
->method('getContainer')
->will($this->returnValue($stubContainer));
$condition1 = new MatchForTotalAmountManager($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values = array(
MatchForTotalAmountManager::INPUT1 => 40.00,
MatchForTotalAmountManager::INPUT2 => 'EUR'
MatchForTotalAmount::INPUT1 => 40.00,
MatchForTotalAmount::INPUT2 => 'EUR'
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -148,7 +148,7 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
->getMock();
$stubContainer->expects($this->any())
->method('get')
->will($this->returnValue(new MatchForTotalAmountManager($stubFacade)));
->will($this->returnValue(new MatchForTotalAmount($stubFacade)));
$stubContainer->expects($this->any())
->method('has')
@@ -158,14 +158,14 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
->method('getContainer')
->will($this->returnValue($stubContainer));
$condition1 = new MatchForTotalAmountManager($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values = array(
MatchForTotalAmountManager::INPUT1 => 40.00,
MatchForTotalAmountManager::INPUT2 => 'EUR'
MatchForTotalAmount::INPUT1 => 40.00,
MatchForTotalAmount::INPUT2 => 'EUR'
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -210,7 +210,7 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
->getMock();
$stubContainer->expects($this->any())
->method('get')
->will($this->returnValue(new MatchForTotalAmountManager($stubFacade)));
->will($this->returnValue(new MatchForTotalAmount($stubFacade)));
$stubContainer->expects($this->any())
->method('has')
@@ -220,25 +220,25 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
->method('getContainer')
->will($this->returnValue($stubContainer));
$condition1 = new MatchForTotalAmountManager($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values = array(
MatchForTotalAmountManager::INPUT1 => 40.00,
MatchForTotalAmountManager::INPUT2 => 'EUR'
MatchForTotalAmount::INPUT1 => 40.00,
MatchForTotalAmount::INPUT2 => 'EUR'
);
$condition1->setValidatorsFromForm($operators, $values);
$condition2 = new MatchForTotalAmountManager($stubFacade);
$condition2 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values = array(
MatchForTotalAmountManager::INPUT1 => 400.00,
MatchForTotalAmountManager::INPUT2 => 'EUR'
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR'
);
$condition2->setValidatorsFromForm($operators, $values);
@@ -287,7 +287,7 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
$stubContainer = $this->getMockBuilder('\Symfony\Component\DependencyInjection\Container')
->disableOriginalConstructor()
->getMock();
$condition1 = new MatchForTotalAmountManager($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$stubContainer->expects($this->any())
->method('get')
->will($this->returnValue($condition1));
@@ -301,12 +301,12 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
->will($this->returnValue($stubContainer));
$operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values = array(
MatchForTotalAmountManager::INPUT1 => 40.00,
MatchForTotalAmountManager::INPUT2 => 'EUR'
MatchForTotalAmount::INPUT1 => 40.00,
MatchForTotalAmount::INPUT2 => 'EUR'
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -352,7 +352,7 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
$stubContainer = $this->getMockBuilder('\Symfony\Component\DependencyInjection\Container')
->disableOriginalConstructor()
->getMock();
$condition1 = new MatchForTotalAmountManager($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$stubContainer->expects($this->any())
->method('get')
->will($this->returnValue($condition1));
@@ -366,12 +366,12 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
->will($this->returnValue($stubContainer));
$operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values = array(
MatchForTotalAmountManager::INPUT1 => 40.00,
MatchForTotalAmountManager::INPUT2 => 'EUR'
MatchForTotalAmount::INPUT1 => 40.00,
MatchForTotalAmount::INPUT2 => 'EUR'
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -421,7 +421,7 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
->getMock();
$stubContainer->expects($this->any())
->method('get')
->will($this->returnValue(new MatchForEveryoneManager($stubFacade)));
->will($this->returnValue(new MatchForEveryone($stubFacade)));
$stubContainer->expects($this->any())
->method('has')
@@ -437,7 +437,7 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
$conditionFactory = new ConditionFactory($stubContainer);
$conditionNone = new MatchForEveryoneManager($stubFacade);
$conditionNone = new MatchForEveryone($stubFacade);
$expectedCollection = new ConditionCollection();
$expectedCollection->add($conditionNone);

View File

@@ -33,13 +33,13 @@ use Thelia\Model\Currency;
* Date: 8/19/13
* Time: 3:24 PM
*
* Unit Test MatchForEveryoneManager Class
* Unit Test MatchForEveryone Class
*
* @package Condition
* @author Guillaume MOREL <gmorel@openstudio.fr>
*
*/
class MatchForEveryoneManagerTest extends \PHPUnit_Framework_TestCase
class MatchForEveryoneTest extends \PHPUnit_Framework_TestCase
{
/** @var FacadeInterface $stubTheliaAdapter */
protected $stubTheliaAdapter = null;
@@ -96,7 +96,7 @@ class MatchForEveryoneManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check if validity test on BackOffice inputs are working
*
* @covers Thelia\Condition\Implementation\MatchForEveryoneManager::setValidators
* @covers Thelia\Condition\Implementation\MatchForEveryone::setValidators
*
*/
public function testValidBackOfficeInputOperator()
@@ -104,7 +104,7 @@ class MatchForEveryoneManagerTest extends \PHPUnit_Framework_TestCase
$stubFacade = $this->generateFacadeStub(399, 'EUR');
/** @var FacadeInterface $stubFacade */
$condition1 = new MatchForEveryoneManager($stubFacade);
$condition1 = new MatchForEveryone($stubFacade);
$operators = array();
$values = array();
$condition1->setValidatorsFromForm($operators, $values);
@@ -119,7 +119,7 @@ class MatchForEveryoneManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check if condition is always matching
*
* @covers Thelia\Condition\Implementation\MatchForEveryoneManager::isMatching
* @covers Thelia\Condition\Implementation\MatchForEveryone::isMatching
*
*/
public function testIsMatching()
@@ -127,7 +127,7 @@ class MatchForEveryoneManagerTest extends \PHPUnit_Framework_TestCase
$stubFacade = $this->generateFacadeStub(399, 'EUR');
/** @var FacadeInterface $stubFacade */
$condition1 = new MatchForEveryoneManager($stubFacade);
$condition1 = new MatchForEveryone($stubFacade);
$isValid = $condition1->isMatching();
@@ -139,7 +139,7 @@ class MatchForEveryoneManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check getName i18n
*
* @covers Thelia\Condition\Implementation\MatchForEveryoneManager::getName
* @covers Thelia\Condition\Implementation\MatchForEveryone::getName
*
*/
public function testGetName()
@@ -147,7 +147,7 @@ class MatchForEveryoneManagerTest extends \PHPUnit_Framework_TestCase
$stubFacade = $this->generateFacadeStub(399, 'EUR', 'Everybody can use it (no condition)');
/** @var FacadeInterface $stubFacade */
$condition1 = new MatchForEveryoneManager($stubFacade);
$condition1 = new MatchForEveryone($stubFacade);
$actual = $condition1->getName();
$expected = 'Everybody can use it (no condition)';
@@ -157,7 +157,7 @@ class MatchForEveryoneManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check tooltip i18n
*
* @covers Thelia\Condition\Implementation\MatchForEveryoneManager::getToolTip
* @covers Thelia\Condition\Implementation\MatchForEveryone::getToolTip
*
*/
public function testGetToolTip()
@@ -165,7 +165,7 @@ class MatchForEveryoneManagerTest extends \PHPUnit_Framework_TestCase
$stubFacade = $this->generateFacadeStub(399, 'EUR', 'Will return always true');
/** @var FacadeInterface $stubFacade */
$condition1 = new MatchForEveryoneManager($stubFacade);
$condition1 = new MatchForEveryone($stubFacade);
$actual = $condition1->getToolTip();
$expected = 'Will return always true';
@@ -175,15 +175,15 @@ class MatchForEveryoneManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check validator
*
* @covers Thelia\Condition\Implementation\MatchForEveryoneManager::generateInputs
* @covers Thelia\Condition\Implementation\MatchForEveryoneManager::setValidatorsFromForm
* @covers Thelia\Condition\Implementation\MatchForEveryone::generateInputs
* @covers Thelia\Condition\Implementation\MatchForEveryone::setValidatorsFromForm
*/
public function testGetValidator()
{
$stubFacade = $this->generateFacadeStub(399, 'EUR');
/** @var FacadeInterface $stubFacade */
$condition1 = new MatchForEveryoneManager($stubFacade);
$condition1 = new MatchForEveryone($stubFacade);
$actual1 = $condition1->setValidatorsFromForm(array(), array());
$expected1 = $condition1;
$actual2 = $condition1->getValidators();

View File

@@ -37,13 +37,13 @@ use Thelia\Model\CurrencyQuery;
* Date: 8/19/13
* Time: 3:24 PM
*
* Unit Test MatchForTotalAmountManager Class
* Unit Test MatchForTotalAmount Class
*
* @package Condition
* @author Guillaume MOREL <gmorel@openstudio.fr>
*
*/
class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
{
/** @var FacadeInterface $stubTheliaAdapter */
protected $stubTheliaAdapter = null;
@@ -97,7 +97,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check if validity test on BackOffice inputs are working
*
* @covers Thelia\Condition\Implementation\MatchForTotalAmountManager::setValidators
* @covers Thelia\Condition\Implementation\MatchForTotalAmount::setValidators
* @expectedException \Thelia\Exception\InvalidConditionOperatorException
*
*/
@@ -106,14 +106,14 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
$stubFacade = $this->generateAdapterStub(399, 'EUR');
/** @var FacadeInterface $stubFacade */
$condition1 = new MatchForTotalAmountManager($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::IN,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
MatchForTotalAmount::INPUT1 => Operators::IN,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values = array(
MatchForTotalAmountManager::INPUT1 => '400',
MatchForTotalAmountManager::INPUT2 => 'EUR');
MatchForTotalAmount::INPUT1 => '400',
MatchForTotalAmount::INPUT2 => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -126,7 +126,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check if validity test on BackOffice inputs are working
*
* @covers Thelia\Condition\Implementation\MatchForTotalAmountManager::setValidators
* @covers Thelia\Condition\Implementation\MatchForTotalAmount::setValidators
* @expectedException \Thelia\Exception\InvalidConditionOperatorException
*
*/
@@ -135,14 +135,14 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
$stubFacade = $this->generateAdapterStub(399, 'EUR');
/** @var FacadeInterface $stubFacade */
$condition1 = new MatchForTotalAmountManager($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmountManager::INPUT2 => Operators::INFERIOR
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::INFERIOR
);
$values = array(
MatchForTotalAmountManager::INPUT1 => '400',
MatchForTotalAmountManager::INPUT2 => 'EUR');
MatchForTotalAmount::INPUT1 => '400',
MatchForTotalAmount::INPUT2 => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -155,7 +155,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check if validity test on BackOffice inputs are working
*
* @covers Thelia\Condition\Implementation\MatchForTotalAmountManager::setValidators
* @covers Thelia\Condition\Implementation\MatchForTotalAmount::setValidators
* @expectedException \Thelia\Exception\InvalidConditionValueException
*
*/
@@ -164,14 +164,14 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/** @var FacadeInterface $stubFacade */
$stubFacade = $this->generateAdapterStub(399, 'EUR');
$condition1 = new MatchForTotalAmountManager($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values = array(
MatchForTotalAmountManager::INPUT1 => 'X',
MatchForTotalAmountManager::INPUT2 => 'EUR');
MatchForTotalAmount::INPUT1 => 'X',
MatchForTotalAmount::INPUT2 => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -184,7 +184,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check if validity test on BackOffice inputs are working
*
* @covers Thelia\Condition\Implementation\MatchForTotalAmountManager::setValidators
* @covers Thelia\Condition\Implementation\MatchForTotalAmount::setValidators
* @expectedException \Thelia\Exception\InvalidConditionValueException
*
*/
@@ -193,14 +193,14 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/** @var FacadeInterface $stubFacade */
$stubFacade = $this->generateAdapterStub(399, 'EUR');
$condition1 = new MatchForTotalAmountManager($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values = array(
MatchForTotalAmountManager::INPUT1 => 400,
MatchForTotalAmountManager::INPUT2 => 'FLA');
MatchForTotalAmount::INPUT1 => 400,
MatchForTotalAmount::INPUT2 => 'FLA');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -213,7 +213,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check if test inferior operator is working
*
* @covers Thelia\Condition\Implementation\MatchForTotalAmountManager::isMatching
* @covers Thelia\Condition\Implementation\MatchForTotalAmount::isMatching
*
*/
public function testMatchingConditionInferior()
@@ -221,14 +221,14 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/** @var FacadeInterface $stubFacade */
$stubFacade = $this->generateAdapterStub(399, 'EUR');
$condition1 = new MatchForTotalAmountManager($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::INFERIOR,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
MatchForTotalAmount::INPUT1 => Operators::INFERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values = array(
MatchForTotalAmountManager::INPUT1 => 400.00,
MatchForTotalAmountManager::INPUT2 => 'EUR');
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -241,7 +241,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check if test inferior operator is working
*
* @covers Thelia\Condition\Implementation\MatchForTotalAmountManager::isMatching
* @covers Thelia\Condition\Implementation\MatchForTotalAmount::isMatching
*
*/
public function testNotMatchingConditionInferior()
@@ -249,14 +249,14 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/** @var FacadeInterface $stubFacade */
$stubFacade = $this->generateAdapterStub(400, 'EUR');
$condition1 = new MatchForTotalAmountManager($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::INFERIOR,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
MatchForTotalAmount::INPUT1 => Operators::INFERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values = array(
MatchForTotalAmountManager::INPUT1 => 400.00,
MatchForTotalAmountManager::INPUT2 => 'EUR');
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -269,7 +269,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check if test inferior operator is working
*
* @covers Thelia\Condition\Implementation\MatchForTotalAmountManager::isMatching
* @covers Thelia\Condition\Implementation\MatchForTotalAmount::isMatching
*
*/
public function testMatchingConditionInferiorEquals()
@@ -277,14 +277,14 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/** @var FacadeInterface $stubFacade */
$stubFacade = $this->generateAdapterStub(400, 'EUR');
$condition1 = new MatchForTotalAmountManager($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::INFERIOR_OR_EQUAL,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
MatchForTotalAmount::INPUT1 => Operators::INFERIOR_OR_EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values = array(
MatchForTotalAmountManager::INPUT1 => 400.00,
MatchForTotalAmountManager::INPUT2 => 'EUR');
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -297,7 +297,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check if test inferior operator is working
*
* @covers Thelia\Condition\Implementation\MatchForTotalAmountManager::isMatching
* @covers Thelia\Condition\Implementation\MatchForTotalAmount::isMatching
*
*/
public function testMatchingConditionInferiorEquals2()
@@ -305,14 +305,14 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/** @var FacadeInterface $stubFacade */
$stubFacade = $this->generateAdapterStub(399, 'EUR');
$condition1 = new MatchForTotalAmountManager($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::INFERIOR_OR_EQUAL,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
MatchForTotalAmount::INPUT1 => Operators::INFERIOR_OR_EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values = array(
MatchForTotalAmountManager::INPUT1 => 400.00,
MatchForTotalAmountManager::INPUT2 => 'EUR');
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -325,7 +325,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check if test inferior operator is working
*
* @covers Thelia\Condition\Implementation\MatchForTotalAmountManager::isMatching
* @covers Thelia\Condition\Implementation\MatchForTotalAmount::isMatching
*
*/
public function testNotMatchingConditionInferiorEquals()
@@ -333,14 +333,14 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/** @var FacadeInterface $stubFacade */
$stubFacade = $this->generateAdapterStub(401, 'EUR');
$condition1 = new MatchForTotalAmountManager($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::INFERIOR_OR_EQUAL,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
MatchForTotalAmount::INPUT1 => Operators::INFERIOR_OR_EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values = array(
MatchForTotalAmountManager::INPUT1 => 400.00,
MatchForTotalAmountManager::INPUT2 => 'EUR');
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -353,7 +353,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check if test equals operator is working
*
* @covers Thelia\Condition\Implementation\MatchForTotalAmountManager::isMatching
* @covers Thelia\Condition\Implementation\MatchForTotalAmount::isMatching
*
*/
public function testMatchingConditionEqual()
@@ -361,14 +361,14 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/** @var FacadeInterface $stubFacade */
$stubFacade = $this->generateAdapterStub(400, 'EUR');
$condition1 = new MatchForTotalAmountManager($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::EQUAL,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
MatchForTotalAmount::INPUT1 => Operators::EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values = array(
MatchForTotalAmountManager::INPUT1 => 400.00,
MatchForTotalAmountManager::INPUT2 => 'EUR');
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -381,7 +381,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check if test equals operator is working
*
* @covers Thelia\Condition\Implementation\MatchForTotalAmountManager::isMatching
* @covers Thelia\Condition\Implementation\MatchForTotalAmount::isMatching
*
*/
public function testNotMatchingConditionEqual()
@@ -389,14 +389,14 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/** @var FacadeInterface $stubFacade */
$stubFacade = $this->generateAdapterStub(399, 'EUR');
$condition1 = new MatchForTotalAmountManager($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::EQUAL,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
MatchForTotalAmount::INPUT1 => Operators::EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values = array(
MatchForTotalAmountManager::INPUT1 => 400.00,
MatchForTotalAmountManager::INPUT2 => 'EUR');
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -409,7 +409,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check if test superior operator is working
*
* @covers Thelia\Condition\Implementation\MatchForTotalAmountManager::isMatching
* @covers Thelia\Condition\Implementation\MatchForTotalAmount::isMatching
*
*/
public function testMatchingConditionSuperiorEquals()
@@ -417,14 +417,14 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/** @var FacadeInterface $stubFacade */
$stubFacade = $this->generateAdapterStub(401, 'EUR');
$condition1 = new MatchForTotalAmountManager($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR_OR_EQUAL,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR_OR_EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values = array(
MatchForTotalAmountManager::INPUT1 => 400.00,
MatchForTotalAmountManager::INPUT2 => 'EUR');
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -437,7 +437,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check if test superior operator is working
*
* @covers Thelia\Condition\Implementation\MatchForTotalAmountManager::isMatching
* @covers Thelia\Condition\Implementation\MatchForTotalAmount::isMatching
*
*/
public function testMatchingConditionSuperiorEquals2()
@@ -445,14 +445,14 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/** @var FacadeInterface $stubFacade */
$stubFacade = $this->generateAdapterStub(400, 'EUR');
$condition1 = new MatchForTotalAmountManager($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR_OR_EQUAL,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR_OR_EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values = array(
MatchForTotalAmountManager::INPUT1 => 400.00,
MatchForTotalAmountManager::INPUT2 => 'EUR');
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -465,7 +465,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check if test superior operator is working
*
* @covers Thelia\Condition\Implementation\MatchForTotalAmountManager::isMatching
* @covers Thelia\Condition\Implementation\MatchForTotalAmount::isMatching
*
*/
public function testNotMatchingConditionSuperiorEquals()
@@ -473,14 +473,14 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/** @var FacadeInterface $stubFacade */
$stubFacade = $this->generateAdapterStub(399, 'EUR');
$condition1 = new MatchForTotalAmountManager($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR_OR_EQUAL,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR_OR_EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values = array(
MatchForTotalAmountManager::INPUT1 => 400.00,
MatchForTotalAmountManager::INPUT2 => 'EUR');
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -493,7 +493,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check if test superior operator is working
*
* @covers Thelia\Condition\Implementation\MatchForTotalAmountManager::isMatching
* @covers Thelia\Condition\Implementation\MatchForTotalAmount::isMatching
*
*/
public function testMatchingConditionSuperior()
@@ -501,14 +501,14 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/** @var FacadeInterface $stubFacade */
$stubFacade = $this->generateAdapterStub(401, 'EUR');
$condition1 = new MatchForTotalAmountManager($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values = array(
MatchForTotalAmountManager::INPUT1 => 400.00,
MatchForTotalAmountManager::INPUT2 => 'EUR');
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -521,7 +521,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check if test superior operator is working
*
* @covers Thelia\Condition\Implementation\MatchForTotalAmountManager::isMatching
* @covers Thelia\Condition\Implementation\MatchForTotalAmount::isMatching
*
*/
public function testNotMatchingConditionSuperior()
@@ -529,14 +529,14 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/** @var FacadeInterface $stubFacade */
$stubFacade = $this->generateAdapterStub(399, 'EUR');
$condition1 = new MatchForTotalAmountManager($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values = array(
MatchForTotalAmountManager::INPUT1 => 400.00,
MatchForTotalAmountManager::INPUT2 => 'EUR');
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -549,7 +549,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check currency is checked
*
* @covers Thelia\Condition\Implementation\MatchForTotalAmountManager::isMatching
* @covers Thelia\Condition\Implementation\MatchForTotalAmount::isMatching
*
*/
public function testMatchingConditionCurrency()
@@ -557,14 +557,14 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/** @var FacadeInterface $stubFacade */
$stubFacade = $this->generateAdapterStub(400, 'EUR');
$condition1 = new MatchForTotalAmountManager($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::EQUAL,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
MatchForTotalAmount::INPUT1 => Operators::EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values = array(
MatchForTotalAmountManager::INPUT1 => 400.00,
MatchForTotalAmountManager::INPUT2 => 'EUR');
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -577,7 +577,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check currency is checked
*
* @covers Thelia\Condition\Implementation\MatchForTotalAmountManager::isMatching
* @covers Thelia\Condition\Implementation\MatchForTotalAmount::isMatching
*
*/
public function testNotMatchingConditionCurrency()
@@ -585,14 +585,14 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/** @var FacadeInterface $stubFacade */
$stubFacade = $this->generateAdapterStub(400.00, 'EUR');
$condition1 = new MatchForTotalAmountManager($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::EQUAL,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
MatchForTotalAmount::INPUT1 => Operators::EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values = array(
MatchForTotalAmountManager::INPUT1 => 400.00,
MatchForTotalAmountManager::INPUT2 => 'USD');
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'USD');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -605,7 +605,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check unknown currency
*
* @covers Thelia\Condition\ConditionManagerAbstract::isCurrencyValid
* @covers Thelia\Condition\ConditionAbstract::isCurrencyValid
* @expectedException \Thelia\Exception\InvalidConditionValueException
*
*/
@@ -634,14 +634,14 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
->will($this->returnValue($currencies));
$condition1 = new MatchForTotalAmountManager($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::EQUAL,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
MatchForTotalAmount::INPUT1 => Operators::EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values = array(
MatchForTotalAmountManager::INPUT1 => 400.00,
MatchForTotalAmountManager::INPUT2 => 'UNK');
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'UNK');
$condition1->setValidatorsFromForm($operators, $values);
@@ -672,7 +672,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check invalid currency
*
* @covers Thelia\Condition\ConditionManagerAbstract::isPriceValid
* @covers Thelia\Condition\ConditionAbstract::isPriceValid
* @expectedException \Thelia\Exception\InvalidConditionValueException
*
*/
@@ -701,14 +701,14 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
->will($this->returnValue($currencies));
$condition1 = new MatchForTotalAmountManager($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::EQUAL,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
MatchForTotalAmount::INPUT1 => Operators::EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values = array(
MatchForTotalAmountManager::INPUT1 => 'notfloat',
MatchForTotalAmountManager::INPUT2 => 'EUR');
MatchForTotalAmount::INPUT1 => 'notfloat',
MatchForTotalAmount::INPUT2 => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
@@ -739,7 +739,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check invalid currency
*
* @covers Thelia\Condition\ConditionManagerAbstract::isPriceValid
* @covers Thelia\Condition\ConditionAbstract::isPriceValid
* @expectedException \Thelia\Exception\InvalidConditionValueException
*
*/
@@ -768,14 +768,14 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
->will($this->returnValue($currencies));
$condition1 = new MatchForTotalAmountManager($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::EQUAL,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
MatchForTotalAmount::INPUT1 => Operators::EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values = array(
MatchForTotalAmountManager::INPUT1 => 0.00,
MatchForTotalAmountManager::INPUT2 => 'EUR');
MatchForTotalAmount::INPUT1 => 0.00,
MatchForTotalAmount::INPUT2 => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
@@ -855,7 +855,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check getName i18n
*
* @covers Thelia\Condition\Implementation\MatchForTotalAmountManager::getName
* @covers Thelia\Condition\Implementation\MatchForTotalAmount::getName
*
*/
public function testGetName()
@@ -863,7 +863,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
$stubFacade = $this->generateFacadeStub(399, 'EUR', 'Cart total amount');
/** @var FacadeInterface $stubFacade */
$condition1 = new MatchForTotalAmountManager($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$actual = $condition1->getName();
$expected = 'Cart total amount';
@@ -873,7 +873,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check tooltip i18n
*
* @covers Thelia\Condition\Implementation\MatchForTotalAmountManager::getToolTip
* @covers Thelia\Condition\Implementation\MatchForTotalAmount::getToolTip
*
*/
public function testGetToolTip()
@@ -881,14 +881,14 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
$stubFacade = $this->generateFacadeStub(399, 'EUR', 'If cart total amount is <strong>%operator%</strong> %amount% %currency%');
/** @var FacadeInterface $stubFacade */
$condition1 = new MatchForTotalAmountManager($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::EQUAL,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
MatchForTotalAmount::INPUT1 => Operators::EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values = array(
MatchForTotalAmountManager::INPUT1 => 400.00,
MatchForTotalAmountManager::INPUT2 => 'EUR');
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$actual = $condition1->getToolTip();
@@ -899,7 +899,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check validator
*
* @covers Thelia\Condition\Implementation\MatchForTotalAmountManager::generateInputs
* @covers Thelia\Condition\Implementation\MatchForTotalAmount::generateInputs
*
*/
public function testGetValidator()
@@ -907,21 +907,21 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
$stubFacade = $this->generateFacadeStub(399, 'EUR', 'Price');
/** @var FacadeInterface $stubFacade */
$condition1 = new MatchForTotalAmountManager($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::EQUAL,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
MatchForTotalAmount::INPUT1 => Operators::EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values = array(
MatchForTotalAmountManager::INPUT1 => 400.00,
MatchForTotalAmountManager::INPUT2 => 'EUR');
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$actual = $condition1->getValidators();
$validators = array(
'inputs' => array(
MatchForTotalAmountManager::INPUT1 => array(
MatchForTotalAmount::INPUT1 => array(
'title' => 'Price',
'availableOperators' => array(
'<' => 'Price',
@@ -936,7 +936,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
'value' => '',
'selectedOperator' => ''
),
MatchForTotalAmountManager::INPUT2 => array(
MatchForTotalAmount::INPUT2 => array(
'title' => 'Price',
'availableOperators' => array('==' => 'Price'),
'availableValues' => array(

View File

@@ -33,13 +33,13 @@ use Thelia\Coupon\FacadeInterface;
* Date: 8/19/13
* Time: 3:24 PM
*
* Unit Test MatchForXArticlesManager Class
* Unit Test MatchForXArticles Class
*
* @package Constraint
* @author Guillaume MOREL <gmorel@openstudio.fr>
*
*/
class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
{
/**
@@ -54,7 +54,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check if validity test on BackOffice inputs are working
*
* @covers Thelia\Condition\Implementation\MatchForXArticlesManager::setValidators
* @covers Thelia\Condition\Implementation\MatchForXArticles::setValidators
* @expectedException \Thelia\Exception\InvalidConditionOperatorException
*/
public function testInValidBackOfficeInputOperator()
@@ -72,12 +72,12 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator()));
$condition1 = new MatchForXArticlesManager($stubFacade);
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticlesManager::INPUT1 => Operators::IN
MatchForXArticles::INPUT1 => Operators::IN
);
$values = array(
MatchForXArticlesManager::INPUT1 => 5
MatchForXArticles::INPUT1 => 5
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -91,7 +91,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check if validity test on BackOffice inputs are working
*
* @covers Thelia\Condition\Implementation\MatchForXArticlesManager::setValidators
* @covers Thelia\Condition\Implementation\MatchForXArticles::setValidators
* @expectedException \Thelia\Exception\InvalidConditionValueException
*/
public function testInValidBackOfficeInputValue()
@@ -108,12 +108,12 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator()));
$condition1 = new MatchForXArticlesManager($stubFacade);
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR
MatchForXArticles::INPUT1 => Operators::SUPERIOR
);
$values = array(
MatchForXArticlesManager::INPUT1 => 'X'
MatchForXArticles::INPUT1 => 'X'
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -127,7 +127,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check if test inferior operator is working
*
* @covers Thelia\Condition\Implementation\MatchForXArticlesManager::isMatching
* @covers Thelia\Condition\Implementation\MatchForXArticles::isMatching
*
*/
public function testMatchingRuleInferior()
@@ -144,12 +144,12 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator()));
$condition1 = new MatchForXArticlesManager($stubFacade);
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticlesManager::INPUT1 => Operators::INFERIOR
MatchForXArticles::INPUT1 => Operators::INFERIOR
);
$values = array(
MatchForXArticlesManager::INPUT1 => 5
MatchForXArticles::INPUT1 => 5
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -163,7 +163,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check if test inferior operator is working
*
* @covers Thelia\Condition\Implementation\MatchForXArticlesManager::isMatching
* @covers Thelia\Condition\Implementation\MatchForXArticles::isMatching
*
*/
public function testNotMatchingRuleInferior()
@@ -180,12 +180,12 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator()));
$condition1 = new MatchForXArticlesManager($stubFacade);
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticlesManager::INPUT1 => Operators::INFERIOR
MatchForXArticles::INPUT1 => Operators::INFERIOR
);
$values = array(
MatchForXArticlesManager::INPUT1 => 4,
MatchForXArticles::INPUT1 => 4,
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -199,7 +199,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check if test inferior operator is working
*
* @covers Thelia\Condition\Implementation\MatchForXArticlesManager::isMatching
* @covers Thelia\Condition\Implementation\MatchForXArticles::isMatching
*
*/
public function testMatchingRuleInferiorEquals()
@@ -216,12 +216,12 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator()));
$condition1 = new MatchForXArticlesManager($stubFacade);
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticlesManager::INPUT1 => Operators::INFERIOR_OR_EQUAL,
MatchForXArticles::INPUT1 => Operators::INFERIOR_OR_EQUAL,
);
$values = array(
MatchForXArticlesManager::INPUT1 => 5,
MatchForXArticles::INPUT1 => 5,
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -235,7 +235,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check if test inferior operator is working
*
* @covers Thelia\Condition\Implementation\MatchForXArticlesManager::isMatching
* @covers Thelia\Condition\Implementation\MatchForXArticles::isMatching
*
*/
public function testMatchingRuleInferiorEquals2()
@@ -252,12 +252,12 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator()));
$condition1 = new MatchForXArticlesManager($stubFacade);
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticlesManager::INPUT1 => Operators::INFERIOR_OR_EQUAL
MatchForXArticles::INPUT1 => Operators::INFERIOR_OR_EQUAL
);
$values = array(
MatchForXArticlesManager::INPUT1 => 4
MatchForXArticles::INPUT1 => 4
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -271,7 +271,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check if test inferior operator is working
*
* @covers Thelia\Condition\Implementation\MatchForXArticlesManager::isMatching
* @covers Thelia\Condition\Implementation\MatchForXArticles::isMatching
*
*/
public function testNotMatchingRuleInferiorEquals()
@@ -288,12 +288,12 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator()));
$condition1 = new MatchForXArticlesManager($stubFacade);
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticlesManager::INPUT1 => Operators::INFERIOR_OR_EQUAL
MatchForXArticles::INPUT1 => Operators::INFERIOR_OR_EQUAL
);
$values = array(
MatchForXArticlesManager::INPUT1 => 3
MatchForXArticles::INPUT1 => 3
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -307,7 +307,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check if test equals operator is working
*
* @covers Thelia\Condition\Implementation\MatchForXArticlesManager::isMatching
* @covers Thelia\Condition\Implementation\MatchForXArticles::isMatching
*
*/
public function testMatchingRuleEqual()
@@ -324,12 +324,12 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator()));
$condition1 = new MatchForXArticlesManager($stubFacade);
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticlesManager::INPUT1 => Operators::EQUAL
MatchForXArticles::INPUT1 => Operators::EQUAL
);
$values = array(
MatchForXArticlesManager::INPUT1 => 4
MatchForXArticles::INPUT1 => 4
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -343,7 +343,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check if test equals operator is working
*
* @covers Thelia\Condition\Implementation\MatchForXArticlesManager::isMatching
* @covers Thelia\Condition\Implementation\MatchForXArticles::isMatching
*
*/
public function testNotMatchingRuleEqual()
@@ -360,12 +360,12 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator()));
$condition1 = new MatchForXArticlesManager($stubFacade);
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticlesManager::INPUT1 => Operators::EQUAL
MatchForXArticles::INPUT1 => Operators::EQUAL
);
$values = array(
MatchForXArticlesManager::INPUT1 => 5
MatchForXArticles::INPUT1 => 5
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -379,7 +379,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check if test superior operator is working
*
* @covers Thelia\Condition\Implementation\MatchForXArticlesManager::isMatching
* @covers Thelia\Condition\Implementation\MatchForXArticles::isMatching
*
*/
public function testMatchingRuleSuperiorEquals()
@@ -396,12 +396,12 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator()));
$condition1 = new MatchForXArticlesManager($stubFacade);
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR_OR_EQUAL
MatchForXArticles::INPUT1 => Operators::SUPERIOR_OR_EQUAL
);
$values = array(
MatchForXArticlesManager::INPUT1 => 4
MatchForXArticles::INPUT1 => 4
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -415,7 +415,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check if test superior operator is working
*
* @covers Thelia\Condition\Implementation\MatchForXArticlesManager::isMatching
* @covers Thelia\Condition\Implementation\MatchForXArticles::isMatching
*
*/
public function testMatchingRuleSuperiorEquals2()
@@ -432,12 +432,12 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator()));
$condition1 = new MatchForXArticlesManager($stubFacade);
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR_OR_EQUAL
MatchForXArticles::INPUT1 => Operators::SUPERIOR_OR_EQUAL
);
$values = array(
MatchForXArticlesManager::INPUT1 => 3
MatchForXArticles::INPUT1 => 3
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -451,7 +451,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check if test superior operator is working
*
* @covers Thelia\Condition\Implementation\MatchForXArticlesManager::isMatching
* @covers Thelia\Condition\Implementation\MatchForXArticles::isMatching
*
*/
public function testNotMatchingRuleSuperiorEquals()
@@ -468,12 +468,12 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator()));
$condition1 = new MatchForXArticlesManager($stubFacade);
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR_OR_EQUAL
MatchForXArticles::INPUT1 => Operators::SUPERIOR_OR_EQUAL
);
$values = array(
MatchForXArticlesManager::INPUT1 => 5
MatchForXArticles::INPUT1 => 5
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -487,7 +487,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check if test superior operator is working
*
* @covers Thelia\Condition\Implementation\MatchForXArticlesManager::isMatching
* @covers Thelia\Condition\Implementation\MatchForXArticles::isMatching
*
*/
public function testMatchingRuleSuperior()
@@ -504,12 +504,12 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator()));
$condition1 = new MatchForXArticlesManager($stubFacade);
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR
MatchForXArticles::INPUT1 => Operators::SUPERIOR
);
$values = array(
MatchForXArticlesManager::INPUT1 => 3
MatchForXArticles::INPUT1 => 3
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -523,7 +523,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check if test superior operator is working
*
* @covers Thelia\Condition\Implementation\MatchForXArticlesManager::isMatching
* @covers Thelia\Condition\Implementation\MatchForXArticles::isMatching
*
*/
public function testNotMatchingRuleSuperior()
@@ -540,12 +540,12 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator()));
$condition1 = new MatchForXArticlesManager($stubFacade);
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR
MatchForXArticles::INPUT1 => Operators::SUPERIOR
);
$values = array(
MatchForXArticlesManager::INPUT1 => 4
MatchForXArticles::INPUT1 => 4
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -570,12 +570,12 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator()));
$condition1 = new MatchForXArticlesManager($stubFacade);
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR
MatchForXArticles::INPUT1 => Operators::SUPERIOR
);
$values = array(
MatchForXArticlesManager::INPUT1 => 4
MatchForXArticles::INPUT1 => 4
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -606,17 +606,17 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator()));
$condition1 = new MatchForXArticlesManager($stubFacade);
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR
MatchForXArticles::INPUT1 => Operators::SUPERIOR
);
$values = array(
MatchForXArticlesManager::INPUT1 => 4
MatchForXArticles::INPUT1 => 4
);
$condition1->setValidatorsFromForm($operators, $values);
$expected = array(
MatchForXArticlesManager::INPUT1 => array(
MatchForXArticles::INPUT1 => array(
Operators::INFERIOR,
Operators::INFERIOR_OR_EQUAL,
Operators::EQUAL,
@@ -674,7 +674,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check getName i18n
*
* @covers Thelia\Condition\Implementation\MatchForXArticlesManager::getName
* @covers Thelia\Condition\Implementation\MatchForXArticles::getName
*
*/
public function testGetName()
@@ -682,7 +682,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
$stubFacade = $this->generateFacadeStub(399, 'EUR', 'Number of articles in cart');
/** @var FacadeInterface $stubFacade */
$condition1 = new MatchForXArticlesManager($stubFacade);
$condition1 = new MatchForXArticles($stubFacade);
$actual = $condition1->getName();
$expected = 'Number of articles in cart';
@@ -692,7 +692,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check tooltip i18n
*
* @covers Thelia\Condition\Implementation\MatchForXArticlesManager::getToolTip
* @covers Thelia\Condition\Implementation\MatchForXArticles::getToolTip
*
*/
public function testGetToolTip()
@@ -700,12 +700,12 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
$stubFacade = $this->generateFacadeStub(399, 'EUR', 'If cart products quantity is <strong>superior to</strong> 4');
/** @var FacadeInterface $stubFacade */
$condition1 = new MatchForXArticlesManager($stubFacade);
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR
MatchForXArticles::INPUT1 => Operators::SUPERIOR
);
$values = array(
MatchForXArticlesManager::INPUT1 => 4
MatchForXArticles::INPUT1 => 4
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -717,7 +717,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
/**
* Check validator
*
* @covers Thelia\Condition\Implementation\MatchForXArticlesManager::generateInputs
* @covers Thelia\Condition\Implementation\MatchForXArticles::generateInputs
*
*/
public function testGetValidator()
@@ -725,12 +725,12 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
$stubFacade = $this->generateFacadeStub(399, 'EUR', 'Price');
/** @var FacadeInterface $stubFacade */
$condition1 = new MatchForXArticlesManager($stubFacade);
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR
MatchForXArticles::INPUT1 => Operators::SUPERIOR
);
$values = array(
MatchForXArticlesManager::INPUT1 => 4
MatchForXArticles::INPUT1 => 4
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -738,7 +738,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
$validators = array(
'inputs' => array(
MatchForXArticlesManager::INPUT1 => array(
MatchForXArticles::INPUT1 => array(
'title' => 'Price',
'availableOperators' => array(
'<' => 'Price',

View File

@@ -25,9 +25,9 @@ namespace Thelia\Coupon;
use Thelia\Condition\ConditionCollection;
use Thelia\Condition\ConditionEvaluator;
use Thelia\Condition\ConditionFactory;
use Thelia\Condition\Implementation\MatchForTotalAmountManager;
use Thelia\Condition\Implementation\MatchForTotalAmount;
use Thelia\Condition\Operators;
use Thelia\Coupon\Type\RemoveXAmountManager;
use Thelia\Coupon\Type\RemoveXAmount;
use Thelia\Model\Coupon;
use Thelia\Model\CurrencyQuery;
@@ -131,25 +131,25 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
$date = new \DateTime();
$coupon1->setExpirationDate($date->setTimestamp(strtotime("today + 3 months")));
$condition1 = new MatchForTotalAmountManager($facade);
$condition1 = new MatchForTotalAmount($facade);
$operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values = array(
MatchForTotalAmountManager::INPUT1 => 40.00,
MatchForTotalAmountManager::INPUT2 => 'EUR'
MatchForTotalAmount::INPUT1 => 40.00,
MatchForTotalAmount::INPUT2 => 'EUR'
);
$condition1->setValidatorsFromForm($operators, $values);
$condition2 = new MatchForTotalAmountManager($facade);
$condition2 = new MatchForTotalAmount($facade);
$operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::INFERIOR,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL
MatchForTotalAmount::INPUT1 => Operators::INFERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values = array(
MatchForTotalAmountManager::INPUT1 => 400.00,
MatchForTotalAmountManager::INPUT2 => 'EUR'
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR'
);
$condition2->setValidatorsFromForm($operators, $values);
@@ -178,36 +178,67 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
}
/**
* @covers Thelia\Coupon\CouponFactory::buildCouponFromCode
* @covers Thelia\Coupon\CouponFactory::buildCouponManagerFromCode
*/
public function testBuildCouponFromCode()
{
$stubFacade = $this->generateFacadeStub();
$stubContainer = $this->getMockBuilder('\Symfony\Component\DependencyInjection\Container')
->disableOriginalConstructor()
->getMock();
$stubContainer = $this->getMock('\Symfony\Component\DependencyInjection\Container');
$conditionFactory = new ConditionFactory($stubContainer);
$expected = $this->generateCouponModel($stubFacade, $conditionFactory);
$couponModel = $this->generateCouponModel($stubFacade, $conditionFactory);
$stubFacade->expects($this->any())
->method('findOneCouponByCode')
->will($this->returnValue($expected));
$stubContainer->expects($this->at(0))
->method('get')
->will($this->returnValue($stubFacade));
->will($this->returnValue($couponModel));
$couponManager = new RemoveXAmountManager();
$stubContainer->expects($this->at(1))
$couponManager = new RemoveXAmount($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 40.00,
MatchForTotalAmount::INPUT2 => 'EUR'
);
$condition1->setValidatorsFromForm($operators, $values);
$condition2 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::INFERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR'
);
$condition2->setValidatorsFromForm($operators, $values);
$conditions = new ConditionCollection();
$conditions->add($condition1);
$conditions->add($condition2);
$stubConditionFactory = $this->getMockBuilder('\Thelia\Condition\ConditionFactory')
->disableOriginalConstructor()
->getMock();
$stubConditionFactory->expects($this->any())
->method('unserializeConditionCollection')
->will($this->returnValue($conditions));
$stubContainer->expects($this->any())
->method('get')
->will($this->returnValue($couponManager));
->will($this->onConsecutiveCalls($stubFacade, $couponManager, $stubConditionFactory));
$stubContainer->expects($this->any())
->method('has')
->will($this->returnValue(true));
$factory = new CouponFactory($stubContainer);
$actual = $factory->buildCouponFromCode('XMAS');
$expected = $couponManager;
$actual = $factory->buildCouponManagerFromCode('XMAS');
$this->assertEquals($expected, $actual);
}

View File

@@ -28,17 +28,17 @@ namespace Thelia\Coupon\Type;
* Date: 8/19/13
* Time: 3:24 PM
*
* Unit Test RemoveXAmountManager Class
* Unit Test RemoveXAmount Class
* Generated by PHPUnit_SkeletonGenerator 1.2.1 on 2013-11-17 at 18:59:24.
*
* @package Coupon
* @author Guillaume MOREL <gmorel@openstudio.fr>
*
*/
class RemoveXAmountManagerTest extends \PHPUnit_Framework_TestCase
class RemoveXAmountTest extends \PHPUnit_Framework_TestCase
{
/**
* @var RemoveXAmountManager
* @var RemoveXAmount
*/
protected $object;
@@ -48,7 +48,7 @@ class RemoveXAmountManagerTest extends \PHPUnit_Framework_TestCase
*/
protected function setUp()
{
// $this->object = new RemoveXAmountManager;
// $this->object = new RemoveXAmount;
}
/**
@@ -60,7 +60,7 @@ class RemoveXAmountManagerTest extends \PHPUnit_Framework_TestCase
}
/**
* @covers Thelia\Coupon\Type\RemoveXAmountManager::set
* @covers Thelia\Coupon\Type\RemoveXAmount::set
* @todo Implement testSet().
*/
public function testSet()
@@ -72,7 +72,7 @@ class RemoveXAmountManagerTest extends \PHPUnit_Framework_TestCase
}
/**
* @covers Thelia\Coupon\Type\RemoveXAmountManager::getName
* @covers Thelia\Coupon\Type\RemoveXAmount::getName
* @todo Implement testGetName().
*/
public function testGetName()
@@ -84,7 +84,7 @@ class RemoveXAmountManagerTest extends \PHPUnit_Framework_TestCase
}
/**
* @covers Thelia\Coupon\Type\RemoveXAmountManager::getToolTip
* @covers Thelia\Coupon\Type\RemoveXAmount::getToolTip
* @todo Implement testGetToolTip().
*/
public function testGetToolTip()

View File

@@ -28,17 +28,17 @@ namespace Thelia\Coupon\Type;
* Date: 8/19/13
* Time: 3:24 PM
*
* Unit Test RemoveXPercentManager Class
* Unit Test RemoveXPercent Class
* Generated by PHPUnit_SkeletonGenerator 1.2.1 on 2013-11-17 at 18:59:24.
*
* @package Coupon
* @author Guillaume MOREL <gmorel@openstudio.fr>
*
*/
class RemoveXPercentManagerTest extends \PHPUnit_Framework_TestCase
class RemoveXPercentTest extends \PHPUnit_Framework_TestCase
{
/**
* @var RemoveXPercentManager
* @var RemoveXPercent
*/
protected $object;
@@ -48,7 +48,7 @@ class RemoveXPercentManagerTest extends \PHPUnit_Framework_TestCase
*/
protected function setUp()
{
// $this->object = new RemoveXPercentManager;
// $this->object = new RemoveXPercent;
}
/**
@@ -60,7 +60,7 @@ class RemoveXPercentManagerTest extends \PHPUnit_Framework_TestCase
}
/**
* @covers Thelia\Coupon\Type\RemoveXPercentManager::set
* @covers Thelia\Coupon\Type\RemoveXPercent::set
* @todo Implement testSet().
*/
public function testSet()
@@ -72,7 +72,7 @@ class RemoveXPercentManagerTest extends \PHPUnit_Framework_TestCase
}
/**
* @covers Thelia\Coupon\Type\RemoveXPercentManager::exec
* @covers Thelia\Coupon\Type\RemoveXPercent::exec
* @todo Implement testExec().
*/
public function testExec()
@@ -84,7 +84,7 @@ class RemoveXPercentManagerTest extends \PHPUnit_Framework_TestCase
}
/**
* @covers Thelia\Coupon\Type\RemoveXPercentManager::getName
* @covers Thelia\Coupon\Type\RemoveXPercent::getName
* @todo Implement testGetName().
*/
public function testGetName()
@@ -96,7 +96,7 @@ class RemoveXPercentManagerTest extends \PHPUnit_Framework_TestCase
}
/**
* @covers Thelia\Coupon\Type\RemoveXPercentManager::getToolTip
* @covers Thelia\Coupon\Type\RemoveXPercent::getToolTip
* @todo Implement testGetToolTip().
*/
public function testGetToolTip()