Refactor removing Manager notion
This commit is contained in:
@@ -25,7 +25,7 @@ namespace Thelia\Action;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Thelia\Condition\ConditionFactory;
|
||||
use Thelia\Condition\ConditionManagerInterface;
|
||||
use Thelia\Condition\ConditionInterface;
|
||||
use Thelia\Core\Event\Coupon\CouponConsumeEvent;
|
||||
use Thelia\Core\Event\Coupon\CouponCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
@@ -102,7 +102,7 @@ class Coupon extends BaseAction implements EventSubscriberInterface
|
||||
$couponManager = $this->container->get('thelia.coupon.manager');
|
||||
|
||||
/** @var CouponInterface $coupon */
|
||||
$coupon = $couponFactory->buildCouponFromCode($event->getCode());
|
||||
$coupon = $couponFactory->buildCouponManagerFromCode($event->getCode());
|
||||
|
||||
$isValid = $coupon->isMatching();
|
||||
|
||||
@@ -154,7 +154,7 @@ class Coupon extends BaseAction implements EventSubscriberInterface
|
||||
$coupon->setDispatcher($this->getDispatcher());
|
||||
|
||||
// Set default condition if none found
|
||||
/** @var ConditionManagerInterface $noConditionRule */
|
||||
/** @var ConditionInterface $noConditionRule */
|
||||
$noConditionRule = $this->container->get('thelia.condition.match_for_everyone');
|
||||
/** @var ConditionFactory $conditionFactory */
|
||||
$conditionFactory = $this->container->get('thelia.condition.factory');
|
||||
|
||||
@@ -24,14 +24,14 @@
|
||||
namespace Thelia\Condition;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Thelia\Condition\ConditionManagerInterface;
|
||||
use Thelia\Condition\ConditionInterface;
|
||||
|
||||
/**
|
||||
* Created by JetBrains PhpStorm.
|
||||
* Date: 8/19/13
|
||||
* Time: 3:24 PM
|
||||
*
|
||||
* Manage a set of ConditionManagerInterface
|
||||
* Manage a set of ConditionInterface
|
||||
*
|
||||
* @package Condition
|
||||
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
||||
@@ -39,13 +39,13 @@ use Thelia\Condition\ConditionManagerInterface;
|
||||
*/
|
||||
class ConditionCollection
|
||||
{
|
||||
/** @var array Array of ConditionManagerInterface */
|
||||
/** @var array Array of ConditionInterface */
|
||||
protected $conditions = array();
|
||||
|
||||
/**
|
||||
* Get Conditions
|
||||
*
|
||||
* @return array Array of ConditionManagerInterface
|
||||
* @return array Array of ConditionInterface
|
||||
*/
|
||||
public function getConditions()
|
||||
{
|
||||
@@ -53,13 +53,13 @@ class ConditionCollection
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a ConditionManagerInterface to the Collection
|
||||
* Add a ConditionInterface to the Collection
|
||||
*
|
||||
* @param ConditionManagerInterface $condition Condition
|
||||
* @param ConditionInterface $condition Condition
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function add(ConditionManagerInterface $condition)
|
||||
public function add(ConditionInterface $condition)
|
||||
{
|
||||
$this->conditions[] = $condition;
|
||||
|
||||
@@ -84,7 +84,7 @@ class ConditionCollection
|
||||
public function __toString()
|
||||
{
|
||||
$arrayToSerialize = array();
|
||||
/** @var ConditionManagerInterface $condition */
|
||||
/** @var ConditionInterface $condition */
|
||||
foreach ($this->getConditions() as $condition) {
|
||||
$arrayToSerialize[] = $condition->getSerializableCondition();
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ class ConditionEvaluator
|
||||
public function isMatching(ConditionCollection $conditions)
|
||||
{
|
||||
$isMatching = true;
|
||||
/** @var ConditionManagerInterface $condition */
|
||||
/** @var ConditionInterface $condition */
|
||||
foreach ($conditions->getConditions() as $condition) {
|
||||
if (!$condition->isMatching()) {
|
||||
$isMatching = false;
|
||||
|
||||
@@ -71,7 +71,7 @@ class ConditionFactory
|
||||
public function serializeConditionCollection(ConditionCollection $collection)
|
||||
{
|
||||
if ($collection->isEmpty()) {
|
||||
/** @var ConditionManagerInterface $conditionNone */
|
||||
/** @var ConditionInterface $conditionNone */
|
||||
$conditionNone = $this->container->get(
|
||||
'thelia.condition.match_for_everyone'
|
||||
);
|
||||
@@ -80,7 +80,7 @@ class ConditionFactory
|
||||
$serializableConditions = array();
|
||||
$conditions = $collection->getConditions();
|
||||
if ($conditions !== null) {
|
||||
/** @var $condition ConditionManagerInterface */
|
||||
/** @var $condition ConditionInterface */
|
||||
foreach ($conditions as $condition) {
|
||||
$serializableConditions[] = $condition->getSerializableCondition();
|
||||
}
|
||||
@@ -106,7 +106,7 @@ class ConditionFactory
|
||||
/** @var SerializableCondition $condition */
|
||||
foreach ($unserializedConditions as $condition) {
|
||||
if ($this->container->has($condition->conditionServiceId)) {
|
||||
/** @var ConditionManagerInterface $conditionManager */
|
||||
/** @var ConditionInterface $conditionManager */
|
||||
$conditionManager = $this->build(
|
||||
$condition->conditionServiceId,
|
||||
(array) $condition->operators,
|
||||
@@ -129,7 +129,7 @@ class ConditionFactory
|
||||
* @param array $values Values setting this Condition
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @return ConditionManagerInterface Ready to use Condition or false
|
||||
* @return ConditionInterface Ready to use Condition or false
|
||||
*/
|
||||
public function build($conditionServiceId, array $operators, array $values)
|
||||
{
|
||||
@@ -137,7 +137,7 @@ class ConditionFactory
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @var ConditionManagerInterface $condition */
|
||||
/** @var ConditionInterface $condition */
|
||||
$condition = $this->container->get($conditionServiceId);
|
||||
$condition->setValidatorsFromForm($operators, $values);
|
||||
|
||||
@@ -157,7 +157,7 @@ class ConditionFactory
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @var ConditionManagerInterface $condition */
|
||||
/** @var ConditionInterface $condition */
|
||||
$condition = $this->container->get($conditionServiceId);
|
||||
|
||||
return $condition->getValidators();
|
||||
|
||||
@@ -37,11 +37,11 @@ namespace Thelia\Condition;
|
||||
class ConditionOrganizer implements ConditionOrganizerInterface
|
||||
{
|
||||
/**
|
||||
* Organize ConditionManagerInterface
|
||||
* Organize ConditionInterface
|
||||
*
|
||||
* @param array $conditions Array of ConditionManagerInterface
|
||||
* @param array $conditions Array of ConditionInterface
|
||||
*
|
||||
* @return array Array of ConditionManagerInterface sorted
|
||||
* @return array Array of ConditionInterface sorted
|
||||
*/
|
||||
public function organize(array $conditions)
|
||||
{
|
||||
|
||||
@@ -37,11 +37,11 @@ namespace Thelia\Condition;
|
||||
interface ConditionOrganizerInterface
|
||||
{
|
||||
/**
|
||||
* Organize ConditionManagerInterface
|
||||
* Organize ConditionInterface
|
||||
*
|
||||
* @param array $conditions Array of ConditionManagerInterface
|
||||
* @param array $conditions Array of ConditionInterface
|
||||
*
|
||||
* @return array Array of ConditionManagerInterface sorted
|
||||
* @return array Array of ConditionInterface sorted
|
||||
*/
|
||||
public function organize(array $conditions);
|
||||
}
|
||||
@@ -41,7 +41,7 @@ use Thelia\Type\FloatType;
|
||||
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
||||
*
|
||||
*/
|
||||
abstract class ConditionManagerAbstract implements ConditionManagerInterface
|
||||
abstract class ConditionAbstract implements ConditionInterface
|
||||
{
|
||||
|
||||
/** @var string Service Id from Resources/config.xml */
|
||||
@@ -37,7 +37,7 @@ use Thelia\Coupon\FacadeInterface;
|
||||
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
||||
*
|
||||
*/
|
||||
interface ConditionManagerInterface
|
||||
interface ConditionInterface
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
@@ -24,7 +24,7 @@
|
||||
namespace Thelia\Condition\Implementation;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use Thelia\Condition\ConditionManagerAbstract;
|
||||
use Thelia\Condition\ConditionAbstract;
|
||||
|
||||
/**
|
||||
* Created by JetBrains PhpStorm.
|
||||
@@ -37,7 +37,7 @@ use Thelia\Condition\ConditionManagerAbstract;
|
||||
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
||||
*
|
||||
*/
|
||||
class MatchForEveryoneManager extends ConditionManagerAbstract
|
||||
class MatchForEveryone extends ConditionAbstract
|
||||
{
|
||||
/** @var string Service Id from Resources/config.xml */
|
||||
protected $serviceId = 'thelia.condition.match_for_everyone';
|
||||
@@ -24,7 +24,7 @@
|
||||
namespace Thelia\Condition\Implementation;
|
||||
|
||||
use Symfony\Component\Intl\Exception\NotImplementedException;
|
||||
use Thelia\Condition\ConditionManagerAbstract;
|
||||
use Thelia\Condition\ConditionAbstract;
|
||||
use Thelia\Condition\Operators;
|
||||
use Thelia\Exception\InvalidConditionOperatorException;
|
||||
use Thelia\Model\Currency;
|
||||
@@ -42,7 +42,7 @@ use Thelia\Model\CurrencyQuery;
|
||||
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
||||
*
|
||||
*/
|
||||
class MatchForTotalAmountManager extends ConditionManagerAbstract
|
||||
class MatchForTotalAmount extends ConditionAbstract
|
||||
{
|
||||
/** Condition 1st parameter : price */
|
||||
CONST INPUT1 = 'price';
|
||||
@@ -24,7 +24,7 @@
|
||||
namespace Thelia\Condition\Implementation;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use Thelia\Condition\ConditionManagerAbstract;
|
||||
use Thelia\Condition\ConditionAbstract;
|
||||
use Thelia\Condition\Operators;
|
||||
use Thelia\Exception\InvalidConditionOperatorException;
|
||||
use Thelia\Exception\InvalidConditionValueException;
|
||||
@@ -40,7 +40,7 @@ use Thelia\Exception\InvalidConditionValueException;
|
||||
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
||||
*
|
||||
*/
|
||||
class MatchForXArticlesManager extends ConditionManagerAbstract
|
||||
class MatchForXArticles extends ConditionAbstract
|
||||
{
|
||||
/** Condition 1st parameter : quantity */
|
||||
CONST INPUT1 = 'quantity';
|
||||
@@ -19,11 +19,11 @@
|
||||
<argument type="service" id="service_container" />
|
||||
</service>
|
||||
|
||||
<service id="thelia.coupon.type.remove_x_amount" class="Thelia\Coupon\Type\RemoveXAmountManager">
|
||||
<service id="thelia.coupon.type.remove_x_amount" class="Thelia\Coupon\Type\RemoveXAmount">
|
||||
<argument type="service" id="thelia.facade" />
|
||||
<tag name="thelia.coupon.addCoupon"/>
|
||||
</service>
|
||||
<service id="thelia.coupon.type.remove_x_percent" class="Thelia\Coupon\Type\RemoveXPercentManager">
|
||||
<service id="thelia.coupon.type.remove_x_percent" class="Thelia\Coupon\Type\RemoveXPercent">
|
||||
<argument type="service" id="thelia.facade" />
|
||||
<tag name="thelia.coupon.addCoupon"/>
|
||||
</service>
|
||||
@@ -35,15 +35,15 @@
|
||||
</service>
|
||||
<service id="thelia.condition.validator" class="Thelia\Condition\ConditionEvaluator">
|
||||
</service>
|
||||
<service id="thelia.condition.match_for_everyone" class="Thelia\Condition\Implementation\MatchForEveryoneManager">
|
||||
<service id="thelia.condition.match_for_everyone" class="Thelia\Condition\Implementation\MatchForEveryone">
|
||||
<argument type="service" id="thelia.facade" />
|
||||
<tag name="thelia.coupon.addCondition"/>
|
||||
</service>
|
||||
<service id="thelia.condition.match_for_total_amount" class="Thelia\Condition\Implementation\MatchForTotalAmountManager">
|
||||
<service id="thelia.condition.match_for_total_amount" class="Thelia\Condition\Implementation\MatchForTotalAmount">
|
||||
<argument type="service" id="thelia.facade" />
|
||||
<tag name="thelia.coupon.addCondition"/>
|
||||
</service>
|
||||
<service id="thelia.condition.match_for_x_articles" class="Thelia\Condition\Implementation\MatchForXArticlesManager">
|
||||
<service id="thelia.condition.match_for_x_articles" class="Thelia\Condition\Implementation\MatchForXArticles">
|
||||
<argument type="service" id="thelia.facade" />
|
||||
<tag name="thelia.coupon.addCondition"/>
|
||||
</service>
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Thelia\Controller\Admin;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Router;
|
||||
use Thelia\Condition\ConditionFactory;
|
||||
use Thelia\Condition\ConditionManagerInterface;
|
||||
use Thelia\Condition\ConditionInterface;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Event\Coupon\CouponCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
@@ -227,7 +227,7 @@ class CouponController extends BaseAdminController
|
||||
|
||||
$args['conditionsObject'] = array();
|
||||
|
||||
/** @var ConditionManagerInterface $condition */
|
||||
/** @var ConditionInterface $condition */
|
||||
foreach ($conditions->getConditions() as $condition) {
|
||||
$args['conditionsObject'][] = array(
|
||||
'serviceId' => $condition->getServiceId(),
|
||||
@@ -519,7 +519,7 @@ class CouponController extends BaseAdminController
|
||||
$couponManager = $this->container->get('thelia.coupon.manager');
|
||||
$availableConditions = $couponManager->getAvailableConditions();
|
||||
$cleanedConditions = array();
|
||||
/** @var ConditionManagerInterface $availableCondition */
|
||||
/** @var ConditionInterface $availableCondition */
|
||||
foreach ($availableConditions as $availableCondition) {
|
||||
$condition = array();
|
||||
$condition['serviceId'] = $availableCondition->getServiceId();
|
||||
@@ -564,7 +564,7 @@ class CouponController extends BaseAdminController
|
||||
protected function cleanConditionForTemplate(ConditionCollection $conditions)
|
||||
{
|
||||
$cleanedConditions = array();
|
||||
/** @var $condition ConditionManagerInterface */
|
||||
/** @var $condition ConditionInterface */
|
||||
foreach ($conditions->getConditions() as $condition) {
|
||||
$cleanedConditions[] = $condition->getToolTip();
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ use Thelia\Model\Coupon;
|
||||
*/
|
||||
class CouponCreateOrUpdateEvent extends ActionEvent
|
||||
{
|
||||
/** @var ConditionCollection Array of ConditionManagerInterface */
|
||||
/** @var ConditionCollection Array of ConditionInterface */
|
||||
protected $conditions = null;
|
||||
|
||||
/** @var string Coupon code (ex: XMAS) */
|
||||
@@ -280,7 +280,7 @@ class CouponCreateOrUpdateEvent extends ActionEvent
|
||||
/**
|
||||
* Get Conditions
|
||||
*
|
||||
* @return null|ConditionCollection Array of ConditionManagerInterface
|
||||
* @return null|ConditionCollection Array of ConditionInterface
|
||||
*/
|
||||
public function getConditions()
|
||||
{
|
||||
@@ -290,7 +290,7 @@ class CouponCreateOrUpdateEvent extends ActionEvent
|
||||
/**
|
||||
* Set Conditions
|
||||
*
|
||||
* @param ConditionCollection $conditions Array of ConditionManagerInterface
|
||||
* @param ConditionCollection $conditions Array of ConditionInterface
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Thelia\Core\Template\Loop;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\Util\PropelModelPager;
|
||||
use Thelia\Condition\ConditionFactory;
|
||||
use Thelia\Condition\ConditionManagerInterface;
|
||||
use Thelia\Condition\ConditionInterface;
|
||||
use Thelia\Core\HttpFoundation\Request;
|
||||
use Thelia\Core\Template\Element\BaseI18nLoop;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
@@ -125,7 +125,7 @@ class Coupon extends BaseI18nLoop implements PropelSearchLoopInterface
|
||||
$daysLeftBeforeExpiration = floor($datediff/(60*60*24));
|
||||
|
||||
$cleanedConditions = array();
|
||||
/** @var ConditionManagerInterface $condition */
|
||||
/** @var ConditionInterface $condition */
|
||||
foreach ($conditions->getConditions() as $condition) {
|
||||
$cleanedConditions[] = $condition->getToolTip();
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ class CouponFactory
|
||||
* @throws \Symfony\Component\Translation\Exception\NotFoundResourceException
|
||||
* @return CouponInterface ready to be processed
|
||||
*/
|
||||
public function buildCouponFromCode($couponCode)
|
||||
public function buildCouponManagerFromCode($couponCode)
|
||||
{
|
||||
/** @var Coupon $couponModel */
|
||||
$couponModel = $this->facade->findOneCouponByCode($couponCode);
|
||||
@@ -86,7 +86,7 @@ class CouponFactory
|
||||
}
|
||||
|
||||
/** @var CouponInterface $couponInterface */
|
||||
$couponInterface = $this->buildCouponInterfaceFromModel($couponModel);
|
||||
$couponInterface = $this->buildCouponManagerFromModel($couponModel);
|
||||
if ($couponInterface->getConditions()->isEmpty()) {
|
||||
throw new InvalidConditionException(
|
||||
get_class($couponInterface)
|
||||
@@ -103,7 +103,7 @@ class CouponFactory
|
||||
*
|
||||
* @return CouponInterface ready to use CouponInterface object instance
|
||||
*/
|
||||
protected function buildCouponInterfaceFromModel(Coupon $model)
|
||||
protected function buildCouponManagerFromModel(Coupon $model)
|
||||
{
|
||||
$isCumulative = ($model->getIsCumulative() == 1 ? true : false);
|
||||
$isRemovingPostage = ($model->getIsRemovingPostage() == 1 ? true : false);
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
namespace Thelia\Coupon;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Thelia\Condition\ConditionManagerInterface;
|
||||
use Thelia\Condition\ConditionInterface;
|
||||
use Thelia\Coupon\Type\CouponInterface;
|
||||
use Thelia\Model\Coupon;
|
||||
|
||||
@@ -213,9 +213,9 @@ class CouponManager
|
||||
/**
|
||||
* Add an available ConstraintManager (Services)
|
||||
*
|
||||
* @param ConditionManagerInterface $condition ConditionManagerInterface
|
||||
* @param ConditionInterface $condition ConditionInterface
|
||||
*/
|
||||
public function addAvailableCondition(ConditionManagerInterface $condition)
|
||||
public function addAvailableCondition(ConditionInterface $condition)
|
||||
{
|
||||
$this->availableConditions[] = $condition;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ abstract class CouponAbstract implements CouponInterface
|
||||
/** @var ConditionOrganizerInterface */
|
||||
protected $organizer = null;
|
||||
|
||||
/** @var ConditionCollection Array of ConditionManagerInterface */
|
||||
/** @var ConditionCollection Array of ConditionInterface */
|
||||
protected $conditions = null;
|
||||
|
||||
/** @var ConditionEvaluator Condition validator */
|
||||
@@ -214,7 +214,7 @@ abstract class CouponAbstract implements CouponInterface
|
||||
* Replace the existing Conditions by those given in parameter
|
||||
* If one Condition is badly implemented, no Condition will be added
|
||||
*
|
||||
* @param ConditionCollection $conditions ConditionManagerInterface to add
|
||||
* @param ConditionCollection $conditions ConditionInterface to add
|
||||
*
|
||||
* @return $this
|
||||
* @throws \Thelia\Exception\InvalidConditionException
|
||||
|
||||
@@ -140,7 +140,7 @@ interface CouponInterface
|
||||
/**
|
||||
* Return condition to validate the Coupon or not
|
||||
*
|
||||
* @return ConditionCollection A set of ConditionManagerInterface
|
||||
* @return ConditionCollection A set of ConditionInterface
|
||||
*/
|
||||
public function getConditions();
|
||||
|
||||
@@ -148,7 +148,7 @@ interface CouponInterface
|
||||
* Replace the existing Conditions by those given in parameter
|
||||
* If one Condition is badly implemented, no Condition will be added
|
||||
*
|
||||
* @param ConditionCollection $conditions ConditionManagerInterface to add
|
||||
* @param ConditionCollection $conditions ConditionInterface to add
|
||||
*
|
||||
* @return $this
|
||||
* @throws \Thelia\Exception\InvalidConditionException
|
||||
|
||||
@@ -37,7 +37,7 @@ use Thelia\Coupon\Type\CouponAbstract;
|
||||
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
||||
*
|
||||
*/
|
||||
class RemoveXAmountManager extends CouponAbstract
|
||||
class RemoveXAmount extends CouponAbstract
|
||||
{
|
||||
/** @var string Service Id */
|
||||
protected $serviceId = 'thelia.coupon.type.remove_x_amount';
|
||||
@@ -36,7 +36,7 @@ use Thelia\Exception\MissingFacadeException;
|
||||
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
||||
*
|
||||
*/
|
||||
class RemoveXPercentManager extends CouponAbstract
|
||||
class RemoveXPercent extends CouponAbstract
|
||||
{
|
||||
/** @var string Service Id */
|
||||
protected $serviceId = 'thelia.coupon.type.remove_x_percent';
|
||||
@@ -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();
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Thelia\Condition\ConditionFactory;
|
||||
use Thelia\Condition\Implementation\MatchForEveryoneManager;
|
||||
use Thelia\Condition\Implementation\MatchForTotalAmountManager;
|
||||
use Thelia\Condition\Implementation\MatchForXArticlesManager;
|
||||
use Thelia\Condition\Implementation\MatchForEveryone;
|
||||
use Thelia\Condition\Implementation\MatchForTotalAmount;
|
||||
use Thelia\Condition\Implementation\MatchForXArticles;
|
||||
use Thelia\Condition\Operators;
|
||||
use Thelia\Coupon\FacadeInterface;
|
||||
use Thelia\Condition\ConditionCollection;
|
||||
@@ -669,25 +669,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($adapter);
|
||||
$condition1 = new MatchForTotalAmount($adapter);
|
||||
$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($adapter);
|
||||
$condition2 = new MatchForTotalAmount($adapter);
|
||||
$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);
|
||||
|
||||
@@ -727,12 +727,12 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
|
||||
$date = new \DateTime();
|
||||
$coupon2->setExpirationDate($date->setTimestamp(strtotime("today + 1 months")));
|
||||
|
||||
$condition1 = new MatchForXArticlesManager($adapter);
|
||||
$condition1 = new MatchForXArticles($adapter);
|
||||
$operators = array(
|
||||
MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR,
|
||||
MatchForXArticles::INPUT1 => Operators::SUPERIOR,
|
||||
);
|
||||
$values = array(
|
||||
MatchForXArticlesManager::INPUT1 => 4,
|
||||
MatchForXArticles::INPUT1 => 4,
|
||||
);
|
||||
$condition1->setValidatorsFromForm($operators, $values);
|
||||
$conditions = new ConditionCollection();
|
||||
@@ -771,7 +771,7 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
|
||||
$date = new \DateTime();
|
||||
$coupon3->setExpirationDate($date->setTimestamp(strtotime("today + 2 months")));
|
||||
|
||||
$condition1 = new MatchForEveryoneManager($adapter);
|
||||
$condition1 = new MatchForEveryone($adapter);
|
||||
$operators = array();
|
||||
$values = array();
|
||||
$condition1->setValidatorsFromForm($operators, $values);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Thelia\Condition\ConditionFactory;
|
||||
use Thelia\Condition\Implementation\MatchForEveryoneManager;
|
||||
use Thelia\Condition\Implementation\MatchForTotalAmountManager;
|
||||
use Thelia\Condition\Implementation\MatchForXArticlesManager;
|
||||
use Thelia\Condition\Implementation\MatchForEveryone;
|
||||
use Thelia\Condition\Implementation\MatchForTotalAmount;
|
||||
use Thelia\Condition\Implementation\MatchForXArticles;
|
||||
use Thelia\Condition\Operators;
|
||||
use Thelia\Coupon\AdapterInterface;
|
||||
use Thelia\Coupon\ConditionCollection;
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
use Thelia\Condition\Implementation\MatchForTotalAmountManager;
|
||||
use Thelia\Condition\Implementation\MatchForXArticlesManager;
|
||||
use Thelia\Condition\Implementation\MatchForTotalAmount;
|
||||
use Thelia\Condition\Implementation\MatchForXArticles;
|
||||
|
||||
|
||||
require __DIR__ . '/../core/bootstrap.php';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
use Thelia\Condition\Implementation\MatchForTotalAmountManager;
|
||||
use Thelia\Condition\Implementation\MatchForXArticlesManager;
|
||||
use Thelia\Condition\Implementation\MatchForTotalAmount;
|
||||
use Thelia\Condition\Implementation\MatchForXArticles;
|
||||
use Imagine\Image\Point;
|
||||
|
||||
require __DIR__ . '/../core/bootstrap.php';
|
||||
|
||||
Reference in New Issue
Block a user