Refactor removing Manager notion

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

View File

@@ -25,7 +25,7 @@ namespace Thelia\Action;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Condition\ConditionFactory; use Thelia\Condition\ConditionFactory;
use Thelia\Condition\ConditionManagerInterface; use Thelia\Condition\ConditionInterface;
use Thelia\Core\Event\Coupon\CouponConsumeEvent; use Thelia\Core\Event\Coupon\CouponConsumeEvent;
use Thelia\Core\Event\Coupon\CouponCreateOrUpdateEvent; use Thelia\Core\Event\Coupon\CouponCreateOrUpdateEvent;
use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\TheliaEvents;
@@ -102,7 +102,7 @@ class Coupon extends BaseAction implements EventSubscriberInterface
$couponManager = $this->container->get('thelia.coupon.manager'); $couponManager = $this->container->get('thelia.coupon.manager');
/** @var CouponInterface $coupon */ /** @var CouponInterface $coupon */
$coupon = $couponFactory->buildCouponFromCode($event->getCode()); $coupon = $couponFactory->buildCouponManagerFromCode($event->getCode());
$isValid = $coupon->isMatching(); $isValid = $coupon->isMatching();
@@ -154,7 +154,7 @@ class Coupon extends BaseAction implements EventSubscriberInterface
$coupon->setDispatcher($this->getDispatcher()); $coupon->setDispatcher($this->getDispatcher());
// Set default condition if none found // Set default condition if none found
/** @var ConditionManagerInterface $noConditionRule */ /** @var ConditionInterface $noConditionRule */
$noConditionRule = $this->container->get('thelia.condition.match_for_everyone'); $noConditionRule = $this->container->get('thelia.condition.match_for_everyone');
/** @var ConditionFactory $conditionFactory */ /** @var ConditionFactory $conditionFactory */
$conditionFactory = $this->container->get('thelia.condition.factory'); $conditionFactory = $this->container->get('thelia.condition.factory');

View File

@@ -24,14 +24,14 @@
namespace Thelia\Condition; namespace Thelia\Condition;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
use Thelia\Condition\ConditionManagerInterface; use Thelia\Condition\ConditionInterface;
/** /**
* Created by JetBrains PhpStorm. * Created by JetBrains PhpStorm.
* Date: 8/19/13 * Date: 8/19/13
* Time: 3:24 PM * Time: 3:24 PM
* *
* Manage a set of ConditionManagerInterface * Manage a set of ConditionInterface
* *
* @package Condition * @package Condition
* @author Guillaume MOREL <gmorel@openstudio.fr> * @author Guillaume MOREL <gmorel@openstudio.fr>
@@ -39,13 +39,13 @@ use Thelia\Condition\ConditionManagerInterface;
*/ */
class ConditionCollection class ConditionCollection
{ {
/** @var array Array of ConditionManagerInterface */ /** @var array Array of ConditionInterface */
protected $conditions = array(); protected $conditions = array();
/** /**
* Get Conditions * Get Conditions
* *
* @return array Array of ConditionManagerInterface * @return array Array of ConditionInterface
*/ */
public function getConditions() 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 * @return $this
*/ */
public function add(ConditionManagerInterface $condition) public function add(ConditionInterface $condition)
{ {
$this->conditions[] = $condition; $this->conditions[] = $condition;
@@ -84,7 +84,7 @@ class ConditionCollection
public function __toString() public function __toString()
{ {
$arrayToSerialize = array(); $arrayToSerialize = array();
/** @var ConditionManagerInterface $condition */ /** @var ConditionInterface $condition */
foreach ($this->getConditions() as $condition) { foreach ($this->getConditions() as $condition) {
$arrayToSerialize[] = $condition->getSerializableCondition(); $arrayToSerialize[] = $condition->getSerializableCondition();
} }

View File

@@ -51,7 +51,7 @@ class ConditionEvaluator
public function isMatching(ConditionCollection $conditions) public function isMatching(ConditionCollection $conditions)
{ {
$isMatching = true; $isMatching = true;
/** @var ConditionManagerInterface $condition */ /** @var ConditionInterface $condition */
foreach ($conditions->getConditions() as $condition) { foreach ($conditions->getConditions() as $condition) {
if (!$condition->isMatching()) { if (!$condition->isMatching()) {
$isMatching = false; $isMatching = false;

View File

@@ -71,7 +71,7 @@ class ConditionFactory
public function serializeConditionCollection(ConditionCollection $collection) public function serializeConditionCollection(ConditionCollection $collection)
{ {
if ($collection->isEmpty()) { if ($collection->isEmpty()) {
/** @var ConditionManagerInterface $conditionNone */ /** @var ConditionInterface $conditionNone */
$conditionNone = $this->container->get( $conditionNone = $this->container->get(
'thelia.condition.match_for_everyone' 'thelia.condition.match_for_everyone'
); );
@@ -80,7 +80,7 @@ class ConditionFactory
$serializableConditions = array(); $serializableConditions = array();
$conditions = $collection->getConditions(); $conditions = $collection->getConditions();
if ($conditions !== null) { if ($conditions !== null) {
/** @var $condition ConditionManagerInterface */ /** @var $condition ConditionInterface */
foreach ($conditions as $condition) { foreach ($conditions as $condition) {
$serializableConditions[] = $condition->getSerializableCondition(); $serializableConditions[] = $condition->getSerializableCondition();
} }
@@ -106,7 +106,7 @@ class ConditionFactory
/** @var SerializableCondition $condition */ /** @var SerializableCondition $condition */
foreach ($unserializedConditions as $condition) { foreach ($unserializedConditions as $condition) {
if ($this->container->has($condition->conditionServiceId)) { if ($this->container->has($condition->conditionServiceId)) {
/** @var ConditionManagerInterface $conditionManager */ /** @var ConditionInterface $conditionManager */
$conditionManager = $this->build( $conditionManager = $this->build(
$condition->conditionServiceId, $condition->conditionServiceId,
(array) $condition->operators, (array) $condition->operators,
@@ -129,7 +129,7 @@ class ConditionFactory
* @param array $values Values setting this Condition * @param array $values Values setting this Condition
* *
* @throws \InvalidArgumentException * @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) public function build($conditionServiceId, array $operators, array $values)
{ {
@@ -137,7 +137,7 @@ class ConditionFactory
return false; return false;
} }
/** @var ConditionManagerInterface $condition */ /** @var ConditionInterface $condition */
$condition = $this->container->get($conditionServiceId); $condition = $this->container->get($conditionServiceId);
$condition->setValidatorsFromForm($operators, $values); $condition->setValidatorsFromForm($operators, $values);
@@ -157,7 +157,7 @@ class ConditionFactory
return false; return false;
} }
/** @var ConditionManagerInterface $condition */ /** @var ConditionInterface $condition */
$condition = $this->container->get($conditionServiceId); $condition = $this->container->get($conditionServiceId);
return $condition->getValidators(); return $condition->getValidators();

View File

@@ -37,11 +37,11 @@ namespace Thelia\Condition;
class ConditionOrganizer implements ConditionOrganizerInterface 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) public function organize(array $conditions)
{ {

View File

@@ -37,11 +37,11 @@ namespace Thelia\Condition;
interface ConditionOrganizerInterface 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); public function organize(array $conditions);
} }

View File

@@ -41,7 +41,7 @@ use Thelia\Type\FloatType;
* @author Guillaume MOREL <gmorel@openstudio.fr> * @author Guillaume MOREL <gmorel@openstudio.fr>
* *
*/ */
abstract class ConditionManagerAbstract implements ConditionManagerInterface abstract class ConditionAbstract implements ConditionInterface
{ {
/** @var string Service Id from Resources/config.xml */ /** @var string Service Id from Resources/config.xml */

View File

@@ -37,7 +37,7 @@ use Thelia\Coupon\FacadeInterface;
* @author Guillaume MOREL <gmorel@openstudio.fr> * @author Guillaume MOREL <gmorel@openstudio.fr>
* *
*/ */
interface ConditionManagerInterface interface ConditionInterface
{ {
/** /**
* Constructor * Constructor

View File

@@ -24,7 +24,7 @@
namespace Thelia\Condition\Implementation; namespace Thelia\Condition\Implementation;
use InvalidArgumentException; use InvalidArgumentException;
use Thelia\Condition\ConditionManagerAbstract; use Thelia\Condition\ConditionAbstract;
/** /**
* Created by JetBrains PhpStorm. * Created by JetBrains PhpStorm.
@@ -37,7 +37,7 @@ use Thelia\Condition\ConditionManagerAbstract;
* @author Guillaume MOREL <gmorel@openstudio.fr> * @author Guillaume MOREL <gmorel@openstudio.fr>
* *
*/ */
class MatchForEveryoneManager extends ConditionManagerAbstract class MatchForEveryone extends ConditionAbstract
{ {
/** @var string Service Id from Resources/config.xml */ /** @var string Service Id from Resources/config.xml */
protected $serviceId = 'thelia.condition.match_for_everyone'; protected $serviceId = 'thelia.condition.match_for_everyone';

View File

@@ -24,7 +24,7 @@
namespace Thelia\Condition\Implementation; namespace Thelia\Condition\Implementation;
use Symfony\Component\Intl\Exception\NotImplementedException; use Symfony\Component\Intl\Exception\NotImplementedException;
use Thelia\Condition\ConditionManagerAbstract; use Thelia\Condition\ConditionAbstract;
use Thelia\Condition\Operators; use Thelia\Condition\Operators;
use Thelia\Exception\InvalidConditionOperatorException; use Thelia\Exception\InvalidConditionOperatorException;
use Thelia\Model\Currency; use Thelia\Model\Currency;
@@ -42,7 +42,7 @@ use Thelia\Model\CurrencyQuery;
* @author Guillaume MOREL <gmorel@openstudio.fr> * @author Guillaume MOREL <gmorel@openstudio.fr>
* *
*/ */
class MatchForTotalAmountManager extends ConditionManagerAbstract class MatchForTotalAmount extends ConditionAbstract
{ {
/** Condition 1st parameter : price */ /** Condition 1st parameter : price */
CONST INPUT1 = 'price'; CONST INPUT1 = 'price';

View File

@@ -24,7 +24,7 @@
namespace Thelia\Condition\Implementation; namespace Thelia\Condition\Implementation;
use InvalidArgumentException; use InvalidArgumentException;
use Thelia\Condition\ConditionManagerAbstract; use Thelia\Condition\ConditionAbstract;
use Thelia\Condition\Operators; use Thelia\Condition\Operators;
use Thelia\Exception\InvalidConditionOperatorException; use Thelia\Exception\InvalidConditionOperatorException;
use Thelia\Exception\InvalidConditionValueException; use Thelia\Exception\InvalidConditionValueException;
@@ -40,7 +40,7 @@ use Thelia\Exception\InvalidConditionValueException;
* @author Guillaume MOREL <gmorel@openstudio.fr> * @author Guillaume MOREL <gmorel@openstudio.fr>
* *
*/ */
class MatchForXArticlesManager extends ConditionManagerAbstract class MatchForXArticles extends ConditionAbstract
{ {
/** Condition 1st parameter : quantity */ /** Condition 1st parameter : quantity */
CONST INPUT1 = 'quantity'; CONST INPUT1 = 'quantity';

View File

@@ -19,11 +19,11 @@
<argument type="service" id="service_container" /> <argument type="service" id="service_container" />
</service> </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" /> <argument type="service" id="thelia.facade" />
<tag name="thelia.coupon.addCoupon"/> <tag name="thelia.coupon.addCoupon"/>
</service> </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" /> <argument type="service" id="thelia.facade" />
<tag name="thelia.coupon.addCoupon"/> <tag name="thelia.coupon.addCoupon"/>
</service> </service>
@@ -35,15 +35,15 @@
</service> </service>
<service id="thelia.condition.validator" class="Thelia\Condition\ConditionEvaluator"> <service id="thelia.condition.validator" class="Thelia\Condition\ConditionEvaluator">
</service> </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" /> <argument type="service" id="thelia.facade" />
<tag name="thelia.coupon.addCondition"/> <tag name="thelia.coupon.addCondition"/>
</service> </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" /> <argument type="service" id="thelia.facade" />
<tag name="thelia.coupon.addCondition"/> <tag name="thelia.coupon.addCondition"/>
</service> </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" /> <argument type="service" id="thelia.facade" />
<tag name="thelia.coupon.addCondition"/> <tag name="thelia.coupon.addCondition"/>
</service> </service>

View File

@@ -26,7 +26,7 @@ namespace Thelia\Controller\Admin;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Router; use Symfony\Component\Routing\Router;
use Thelia\Condition\ConditionFactory; use Thelia\Condition\ConditionFactory;
use Thelia\Condition\ConditionManagerInterface; use Thelia\Condition\ConditionInterface;
use Thelia\Core\Security\Resource\AdminResources; use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Core\Event\Coupon\CouponCreateOrUpdateEvent; use Thelia\Core\Event\Coupon\CouponCreateOrUpdateEvent;
use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\TheliaEvents;
@@ -227,7 +227,7 @@ class CouponController extends BaseAdminController
$args['conditionsObject'] = array(); $args['conditionsObject'] = array();
/** @var ConditionManagerInterface $condition */ /** @var ConditionInterface $condition */
foreach ($conditions->getConditions() as $condition) { foreach ($conditions->getConditions() as $condition) {
$args['conditionsObject'][] = array( $args['conditionsObject'][] = array(
'serviceId' => $condition->getServiceId(), 'serviceId' => $condition->getServiceId(),
@@ -519,7 +519,7 @@ class CouponController extends BaseAdminController
$couponManager = $this->container->get('thelia.coupon.manager'); $couponManager = $this->container->get('thelia.coupon.manager');
$availableConditions = $couponManager->getAvailableConditions(); $availableConditions = $couponManager->getAvailableConditions();
$cleanedConditions = array(); $cleanedConditions = array();
/** @var ConditionManagerInterface $availableCondition */ /** @var ConditionInterface $availableCondition */
foreach ($availableConditions as $availableCondition) { foreach ($availableConditions as $availableCondition) {
$condition = array(); $condition = array();
$condition['serviceId'] = $availableCondition->getServiceId(); $condition['serviceId'] = $availableCondition->getServiceId();
@@ -564,7 +564,7 @@ class CouponController extends BaseAdminController
protected function cleanConditionForTemplate(ConditionCollection $conditions) protected function cleanConditionForTemplate(ConditionCollection $conditions)
{ {
$cleanedConditions = array(); $cleanedConditions = array();
/** @var $condition ConditionManagerInterface */ /** @var $condition ConditionInterface */
foreach ($conditions->getConditions() as $condition) { foreach ($conditions->getConditions() as $condition) {
$cleanedConditions[] = $condition->getToolTip(); $cleanedConditions[] = $condition->getToolTip();
} }

View File

@@ -39,7 +39,7 @@ use Thelia\Model\Coupon;
*/ */
class CouponCreateOrUpdateEvent extends ActionEvent class CouponCreateOrUpdateEvent extends ActionEvent
{ {
/** @var ConditionCollection Array of ConditionManagerInterface */ /** @var ConditionCollection Array of ConditionInterface */
protected $conditions = null; protected $conditions = null;
/** @var string Coupon code (ex: XMAS) */ /** @var string Coupon code (ex: XMAS) */
@@ -280,7 +280,7 @@ class CouponCreateOrUpdateEvent extends ActionEvent
/** /**
* Get Conditions * Get Conditions
* *
* @return null|ConditionCollection Array of ConditionManagerInterface * @return null|ConditionCollection Array of ConditionInterface
*/ */
public function getConditions() public function getConditions()
{ {
@@ -290,7 +290,7 @@ class CouponCreateOrUpdateEvent extends ActionEvent
/** /**
* Set Conditions * Set Conditions
* *
* @param ConditionCollection $conditions Array of ConditionManagerInterface * @param ConditionCollection $conditions Array of ConditionInterface
* *
* @return $this * @return $this
*/ */

View File

@@ -26,7 +26,7 @@ namespace Thelia\Core\Template\Loop;
use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\Util\PropelModelPager; use Propel\Runtime\Util\PropelModelPager;
use Thelia\Condition\ConditionFactory; use Thelia\Condition\ConditionFactory;
use Thelia\Condition\ConditionManagerInterface; use Thelia\Condition\ConditionInterface;
use Thelia\Core\HttpFoundation\Request; use Thelia\Core\HttpFoundation\Request;
use Thelia\Core\Template\Element\BaseI18nLoop; use Thelia\Core\Template\Element\BaseI18nLoop;
use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResult;
@@ -125,7 +125,7 @@ class Coupon extends BaseI18nLoop implements PropelSearchLoopInterface
$daysLeftBeforeExpiration = floor($datediff/(60*60*24)); $daysLeftBeforeExpiration = floor($datediff/(60*60*24));
$cleanedConditions = array(); $cleanedConditions = array();
/** @var ConditionManagerInterface $condition */ /** @var ConditionInterface $condition */
foreach ($conditions->getConditions() as $condition) { foreach ($conditions->getConditions() as $condition) {
$cleanedConditions[] = $condition->getToolTip(); $cleanedConditions[] = $condition->getToolTip();
} }

View File

@@ -71,7 +71,7 @@ class CouponFactory
* @throws \Symfony\Component\Translation\Exception\NotFoundResourceException * @throws \Symfony\Component\Translation\Exception\NotFoundResourceException
* @return CouponInterface ready to be processed * @return CouponInterface ready to be processed
*/ */
public function buildCouponFromCode($couponCode) public function buildCouponManagerFromCode($couponCode)
{ {
/** @var Coupon $couponModel */ /** @var Coupon $couponModel */
$couponModel = $this->facade->findOneCouponByCode($couponCode); $couponModel = $this->facade->findOneCouponByCode($couponCode);
@@ -86,7 +86,7 @@ class CouponFactory
} }
/** @var CouponInterface $couponInterface */ /** @var CouponInterface $couponInterface */
$couponInterface = $this->buildCouponInterfaceFromModel($couponModel); $couponInterface = $this->buildCouponManagerFromModel($couponModel);
if ($couponInterface->getConditions()->isEmpty()) { if ($couponInterface->getConditions()->isEmpty()) {
throw new InvalidConditionException( throw new InvalidConditionException(
get_class($couponInterface) get_class($couponInterface)
@@ -103,7 +103,7 @@ class CouponFactory
* *
* @return CouponInterface ready to use CouponInterface object instance * @return CouponInterface ready to use CouponInterface object instance
*/ */
protected function buildCouponInterfaceFromModel(Coupon $model) protected function buildCouponManagerFromModel(Coupon $model)
{ {
$isCumulative = ($model->getIsCumulative() == 1 ? true : false); $isCumulative = ($model->getIsCumulative() == 1 ? true : false);
$isRemovingPostage = ($model->getIsRemovingPostage() == 1 ? true : false); $isRemovingPostage = ($model->getIsRemovingPostage() == 1 ? true : false);

View File

@@ -24,7 +24,7 @@
namespace Thelia\Coupon; namespace Thelia\Coupon;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
use Thelia\Condition\ConditionManagerInterface; use Thelia\Condition\ConditionInterface;
use Thelia\Coupon\Type\CouponInterface; use Thelia\Coupon\Type\CouponInterface;
use Thelia\Model\Coupon; use Thelia\Model\Coupon;
@@ -213,9 +213,9 @@ class CouponManager
/** /**
* Add an available ConstraintManager (Services) * 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; $this->availableConditions[] = $condition;
} }

View File

@@ -53,7 +53,7 @@ abstract class CouponAbstract implements CouponInterface
/** @var ConditionOrganizerInterface */ /** @var ConditionOrganizerInterface */
protected $organizer = null; protected $organizer = null;
/** @var ConditionCollection Array of ConditionManagerInterface */ /** @var ConditionCollection Array of ConditionInterface */
protected $conditions = null; protected $conditions = null;
/** @var ConditionEvaluator Condition validator */ /** @var ConditionEvaluator Condition validator */
@@ -214,7 +214,7 @@ abstract class CouponAbstract implements CouponInterface
* Replace the existing Conditions by those given in parameter * Replace the existing Conditions by those given in parameter
* If one Condition is badly implemented, no Condition will be added * 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 * @return $this
* @throws \Thelia\Exception\InvalidConditionException * @throws \Thelia\Exception\InvalidConditionException

View File

@@ -140,7 +140,7 @@ interface CouponInterface
/** /**
* Return condition to validate the Coupon or not * Return condition to validate the Coupon or not
* *
* @return ConditionCollection A set of ConditionManagerInterface * @return ConditionCollection A set of ConditionInterface
*/ */
public function getConditions(); public function getConditions();
@@ -148,7 +148,7 @@ interface CouponInterface
* Replace the existing Conditions by those given in parameter * Replace the existing Conditions by those given in parameter
* If one Condition is badly implemented, no Condition will be added * 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 * @return $this
* @throws \Thelia\Exception\InvalidConditionException * @throws \Thelia\Exception\InvalidConditionException

View File

@@ -37,7 +37,7 @@ use Thelia\Coupon\Type\CouponAbstract;
* @author Guillaume MOREL <gmorel@openstudio.fr> * @author Guillaume MOREL <gmorel@openstudio.fr>
* *
*/ */
class RemoveXAmountManager extends CouponAbstract class RemoveXAmount extends CouponAbstract
{ {
/** @var string Service Id */ /** @var string Service Id */
protected $serviceId = 'thelia.coupon.type.remove_x_amount'; protected $serviceId = 'thelia.coupon.type.remove_x_amount';

View File

@@ -36,7 +36,7 @@ use Thelia\Exception\MissingFacadeException;
* @author Guillaume MOREL <gmorel@openstudio.fr> * @author Guillaume MOREL <gmorel@openstudio.fr>
* *
*/ */
class RemoveXPercentManager extends CouponAbstract class RemoveXPercent extends CouponAbstract
{ {
/** @var string Service Id */ /** @var string Service Id */
protected $serviceId = 'thelia.coupon.type.remove_x_percent'; protected $serviceId = 'thelia.coupon.type.remove_x_percent';

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -28,17 +28,17 @@ namespace Thelia\Coupon\Type;
* Date: 8/19/13 * Date: 8/19/13
* Time: 3:24 PM * 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. * Generated by PHPUnit_SkeletonGenerator 1.2.1 on 2013-11-17 at 18:59:24.
* *
* @package Coupon * @package Coupon
* @author Guillaume MOREL <gmorel@openstudio.fr> * @author Guillaume MOREL <gmorel@openstudio.fr>
* *
*/ */
class RemoveXAmountManagerTest extends \PHPUnit_Framework_TestCase class RemoveXAmountTest extends \PHPUnit_Framework_TestCase
{ {
/** /**
* @var RemoveXAmountManager * @var RemoveXAmount
*/ */
protected $object; protected $object;
@@ -48,7 +48,7 @@ class RemoveXAmountManagerTest extends \PHPUnit_Framework_TestCase
*/ */
protected function setUp() 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(). * @todo Implement testSet().
*/ */
public function 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(). * @todo Implement testGetName().
*/ */
public function 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(). * @todo Implement testGetToolTip().
*/ */
public function testGetToolTip() public function testGetToolTip()

View File

@@ -28,17 +28,17 @@ namespace Thelia\Coupon\Type;
* Date: 8/19/13 * Date: 8/19/13
* Time: 3:24 PM * 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. * Generated by PHPUnit_SkeletonGenerator 1.2.1 on 2013-11-17 at 18:59:24.
* *
* @package Coupon * @package Coupon
* @author Guillaume MOREL <gmorel@openstudio.fr> * @author Guillaume MOREL <gmorel@openstudio.fr>
* *
*/ */
class RemoveXPercentManagerTest extends \PHPUnit_Framework_TestCase class RemoveXPercentTest extends \PHPUnit_Framework_TestCase
{ {
/** /**
* @var RemoveXPercentManager * @var RemoveXPercent
*/ */
protected $object; protected $object;
@@ -48,7 +48,7 @@ class RemoveXPercentManagerTest extends \PHPUnit_Framework_TestCase
*/ */
protected function setUp() 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(). * @todo Implement testSet().
*/ */
public function 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(). * @todo Implement testExec().
*/ */
public function 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(). * @todo Implement testGetName().
*/ */
public function 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(). * @todo Implement testGetToolTip().
*/ */
public function testGetToolTip() public function testGetToolTip()

View File

@@ -1,9 +1,9 @@
<?php <?php
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
use Thelia\Condition\ConditionFactory; use Thelia\Condition\ConditionFactory;
use Thelia\Condition\Implementation\MatchForEveryoneManager; use Thelia\Condition\Implementation\MatchForEveryone;
use Thelia\Condition\Implementation\MatchForTotalAmountManager; use Thelia\Condition\Implementation\MatchForTotalAmount;
use Thelia\Condition\Implementation\MatchForXArticlesManager; use Thelia\Condition\Implementation\MatchForXArticles;
use Thelia\Condition\Operators; use Thelia\Condition\Operators;
use Thelia\Coupon\FacadeInterface; use Thelia\Coupon\FacadeInterface;
use Thelia\Condition\ConditionCollection; use Thelia\Condition\ConditionCollection;
@@ -669,25 +669,25 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
$date = new \DateTime(); $date = new \DateTime();
$coupon1->setExpirationDate($date->setTimestamp(strtotime("today + 3 months"))); $coupon1->setExpirationDate($date->setTimestamp(strtotime("today + 3 months")));
$condition1 = new MatchForTotalAmountManager($adapter); $condition1 = new MatchForTotalAmount($adapter);
$operators = array( $operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR, MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL MatchForTotalAmount::INPUT2 => Operators::EQUAL
); );
$values = array( $values = array(
MatchForTotalAmountManager::INPUT1 => 40.00, MatchForTotalAmount::INPUT1 => 40.00,
MatchForTotalAmountManager::INPUT2 => 'EUR' MatchForTotalAmount::INPUT2 => 'EUR'
); );
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
$condition2 = new MatchForTotalAmountManager($adapter); $condition2 = new MatchForTotalAmount($adapter);
$operators = array( $operators = array(
MatchForTotalAmountManager::INPUT1 => Operators::INFERIOR, MatchForTotalAmount::INPUT1 => Operators::INFERIOR,
MatchForTotalAmountManager::INPUT2 => Operators::EQUAL MatchForTotalAmount::INPUT2 => Operators::EQUAL
); );
$values = array( $values = array(
MatchForTotalAmountManager::INPUT1 => 400.00, MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmountManager::INPUT2 => 'EUR' MatchForTotalAmount::INPUT2 => 'EUR'
); );
$condition2->setValidatorsFromForm($operators, $values); $condition2->setValidatorsFromForm($operators, $values);
@@ -727,12 +727,12 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
$date = new \DateTime(); $date = new \DateTime();
$coupon2->setExpirationDate($date->setTimestamp(strtotime("today + 1 months"))); $coupon2->setExpirationDate($date->setTimestamp(strtotime("today + 1 months")));
$condition1 = new MatchForXArticlesManager($adapter); $condition1 = new MatchForXArticles($adapter);
$operators = array( $operators = array(
MatchForXArticlesManager::INPUT1 => Operators::SUPERIOR, MatchForXArticles::INPUT1 => Operators::SUPERIOR,
); );
$values = array( $values = array(
MatchForXArticlesManager::INPUT1 => 4, MatchForXArticles::INPUT1 => 4,
); );
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);
$conditions = new ConditionCollection(); $conditions = new ConditionCollection();
@@ -771,7 +771,7 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
$date = new \DateTime(); $date = new \DateTime();
$coupon3->setExpirationDate($date->setTimestamp(strtotime("today + 2 months"))); $coupon3->setExpirationDate($date->setTimestamp(strtotime("today + 2 months")));
$condition1 = new MatchForEveryoneManager($adapter); $condition1 = new MatchForEveryone($adapter);
$operators = array(); $operators = array();
$values = array(); $values = array();
$condition1->setValidatorsFromForm($operators, $values); $condition1->setValidatorsFromForm($operators, $values);

View File

@@ -1,9 +1,9 @@
<?php <?php
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
use Thelia\Condition\ConditionFactory; use Thelia\Condition\ConditionFactory;
use Thelia\Condition\Implementation\MatchForEveryoneManager; use Thelia\Condition\Implementation\MatchForEveryone;
use Thelia\Condition\Implementation\MatchForTotalAmountManager; use Thelia\Condition\Implementation\MatchForTotalAmount;
use Thelia\Condition\Implementation\MatchForXArticlesManager; use Thelia\Condition\Implementation\MatchForXArticles;
use Thelia\Condition\Operators; use Thelia\Condition\Operators;
use Thelia\Coupon\AdapterInterface; use Thelia\Coupon\AdapterInterface;
use Thelia\Coupon\ConditionCollection; use Thelia\Coupon\ConditionCollection;

View File

@@ -21,8 +21,8 @@
/* */ /* */
/*************************************************************************************/ /*************************************************************************************/
use Thelia\Condition\Implementation\MatchForTotalAmountManager; use Thelia\Condition\Implementation\MatchForTotalAmount;
use Thelia\Condition\Implementation\MatchForXArticlesManager; use Thelia\Condition\Implementation\MatchForXArticles;
require __DIR__ . '/../core/bootstrap.php'; require __DIR__ . '/../core/bootstrap.php';

View File

@@ -1,6 +1,6 @@
<?php <?php
use Thelia\Condition\Implementation\MatchForTotalAmountManager; use Thelia\Condition\Implementation\MatchForTotalAmount;
use Thelia\Condition\Implementation\MatchForXArticlesManager; use Thelia\Condition\Implementation\MatchForXArticles;
use Imagine\Image\Point; use Imagine\Image\Point;
require __DIR__ . '/../core/bootstrap.php'; require __DIR__ . '/../core/bootstrap.php';