Working : Refactor adapter into facade
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
namespace Thelia\Condition;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Thelia\Coupon\AdapterInterface;
|
||||
use Thelia\Coupon\FacadeInterface;
|
||||
use Thelia\Coupon\ConditionCollection;
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ class ConditionFactory
|
||||
/** @var ContainerInterface Service Container */
|
||||
protected $container = null;
|
||||
|
||||
/** @var AdapterInterface Provide necessary value from Thelia */
|
||||
/** @var FacadeInterface Provide necessary value from Thelia */
|
||||
protected $adapter;
|
||||
|
||||
/** @var array ConditionCollection to process*/
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Thelia\Condition;
|
||||
|
||||
use Symfony\Component\Intl\Exception\NotImplementedException;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Coupon\AdapterInterface;
|
||||
use Thelia\Coupon\FacadeInterface;
|
||||
use Thelia\Exception\InvalidConditionValueException;
|
||||
use Thelia\Model\Currency;
|
||||
use Thelia\Type\FloatType;
|
||||
@@ -60,7 +60,7 @@ abstract class ConditionManagerAbstract implements ConditionManagerInterface
|
||||
// /** @var array Parameters to be validated */
|
||||
// protected $paramsToValidate = array();
|
||||
|
||||
/** @var AdapterInterface Provide necessary value from Thelia */
|
||||
/** @var FacadeInterface Provide necessary value from Thelia */
|
||||
protected $adapter = null;
|
||||
|
||||
/** @var Translator Service Translator */
|
||||
@@ -78,9 +78,9 @@ abstract class ConditionManagerAbstract implements ConditionManagerInterface
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param AdapterInterface $adapter Service adapter
|
||||
* @param FacadeInterface $adapter Service adapter
|
||||
*/
|
||||
public function __construct(AdapterInterface $adapter)
|
||||
public function __construct(FacadeInterface $adapter)
|
||||
{
|
||||
$this->adapter = $adapter;
|
||||
$this->translator = $adapter->getTranslator();
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
namespace Thelia\Condition;
|
||||
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Coupon\AdapterInterface;
|
||||
use Thelia\Coupon\FacadeInterface;
|
||||
|
||||
/**
|
||||
* Created by JetBrains PhpStorm.
|
||||
@@ -42,9 +42,9 @@ interface ConditionManagerInterface
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param AdapterInterface $adapter Service adapter
|
||||
* @param FacadeInterface $adapter Service adapter
|
||||
*/
|
||||
function __construct(AdapterInterface $adapter);
|
||||
function __construct(FacadeInterface $adapter);
|
||||
|
||||
/**
|
||||
* Get Rule Service id
|
||||
|
||||
@@ -276,7 +276,7 @@
|
||||
<service id="kernel" synthetic="true" />
|
||||
|
||||
<!-- Coupon module -->
|
||||
<service id="thelia.adapter" class="Thelia\Coupon\BaseAdapter">
|
||||
<service id="thelia.adapter" class="Thelia\Coupon\BaseFacade">
|
||||
<argument type="service" id="service_container" />
|
||||
</service>
|
||||
<service id="thelia.coupon.manager" class="Thelia\Coupon\CouponManager">
|
||||
|
||||
@@ -609,7 +609,7 @@ class CouponController extends BaseAdminController
|
||||
// */
|
||||
// protected function validateConditionsCreation($type, $operator, $values)
|
||||
// {
|
||||
// /** @var AdapterInterface $adapter */
|
||||
// /** @var FacadeInterface $adapter */
|
||||
// $adapter = $this->container->get('thelia.adapter');
|
||||
// $validator = new PriceParam()
|
||||
// try {
|
||||
|
||||
@@ -27,6 +27,7 @@ use Symfony\Component\DependencyInjection\Container;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\Translation\Translator;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Thelia\Condition\ConditionEvaluator;
|
||||
use Thelia\Core\HttpFoundation\Request;
|
||||
use Thelia\Coupon\Type\CouponInterface;
|
||||
use Thelia\Model\Coupon;
|
||||
@@ -47,7 +48,7 @@ use Thelia\Model\CurrencyQuery;
|
||||
* @todo implements
|
||||
*
|
||||
*/
|
||||
class BaseAdapter implements AdapterInterface
|
||||
class BaseFacade implements FacadeInterface
|
||||
{
|
||||
use CartTrait {
|
||||
CartTrait::getCart as getCartFromTrait;
|
||||
@@ -261,7 +262,7 @@ class BaseAdapter implements AdapterInterface
|
||||
/**
|
||||
* Return Constraint Validator
|
||||
*
|
||||
* @return ConditionValidator
|
||||
* @return ConditionEvaluator
|
||||
*/
|
||||
public function getConditionEvaluator()
|
||||
{
|
||||
@@ -47,7 +47,7 @@ class CouponFactory
|
||||
/** @var ContainerInterface Service Container */
|
||||
protected $container = null;
|
||||
|
||||
/** @var AdapterInterface Provide necessary value from Thelia*/
|
||||
/** @var FacadeInterface Provide necessary value from Thelia*/
|
||||
protected $adapter;
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,7 +40,7 @@ use Thelia\Coupon\Type\CouponInterface;
|
||||
*/
|
||||
class CouponManager
|
||||
{
|
||||
/** @var AdapterInterface Provides necessary value from Thelia */
|
||||
/** @var FacadeInterface Provides necessary value from Thelia */
|
||||
protected $adapter = null;
|
||||
|
||||
/** @var ContainerInterface Service Container */
|
||||
|
||||
@@ -43,7 +43,7 @@ use Thelia\Model\Coupon;
|
||||
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
||||
*
|
||||
*/
|
||||
interface AdapterInterface
|
||||
interface FacadeInterface
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -26,7 +26,7 @@ namespace Thelia\Coupon\Type;
|
||||
use Symfony\Component\Intl\Exception\NotImplementedException;
|
||||
use Thelia\Condition\ConditionEvaluator;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Coupon\AdapterInterface;
|
||||
use Thelia\Coupon\FacadeInterface;
|
||||
use Thelia\Coupon\ConditionCollection;
|
||||
use Thelia\Coupon\RuleOrganizerInterface;
|
||||
use Thelia\Exception\InvalidConditionException;
|
||||
@@ -44,7 +44,7 @@ use Thelia\Exception\InvalidConditionException;
|
||||
*/
|
||||
abstract class CouponAbstract implements CouponInterface
|
||||
{
|
||||
/** @var AdapterInterface Provide necessary value from Thelia */
|
||||
/** @var FacadeInterface Provide necessary value from Thelia */
|
||||
protected $adapter = null;
|
||||
|
||||
/** @var Translator Service Translator */
|
||||
@@ -104,9 +104,9 @@ abstract class CouponAbstract implements CouponInterface
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param AdapterInterface $adapter Service adapter
|
||||
* @param FacadeInterface $adapter Service adapter
|
||||
*/
|
||||
public function __construct(AdapterInterface $adapter)
|
||||
public function __construct(FacadeInterface $adapter)
|
||||
{
|
||||
$this->adapter = $adapter;
|
||||
$this->translator = $adapter->getTranslator();
|
||||
@@ -298,7 +298,7 @@ abstract class CouponAbstract implements CouponInterface
|
||||
|
||||
/**
|
||||
* Check if the current state of the application is matching this Coupon conditions
|
||||
* Thelia variables are given by the AdapterInterface
|
||||
* Thelia variables are given by the FacadeInterface
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
namespace Thelia\Coupon\Type;
|
||||
|
||||
use Thelia\Coupon\AdapterInterface;
|
||||
use Thelia\Coupon\FacadeInterface;
|
||||
use Thelia\Coupon\ConditionCollection;
|
||||
|
||||
/**
|
||||
@@ -209,7 +209,7 @@ interface CouponInterface
|
||||
|
||||
/**
|
||||
* Check if the current Coupon is matching its conditions (Rules)
|
||||
* Thelia variables are given by the AdapterInterface
|
||||
* Thelia variables are given by the FacadeInterface
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Thelia\Condition\Implementation;
|
||||
|
||||
use Thelia\Condition\ConditionEvaluator;
|
||||
use Thelia\Condition\Operators;
|
||||
use Thelia\Coupon\AdapterInterface;
|
||||
use Thelia\Coupon\FacadeInterface;
|
||||
use Thelia\Coupon\ConditionCollection;
|
||||
use Thelia\Model\CurrencyQuery;
|
||||
|
||||
@@ -57,7 +57,7 @@ class ConditionEvaluatorTest extends \PHPUnit_Framework_TestCase
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@@ -131,7 +131,7 @@ class ConditionEvaluatorTest extends \PHPUnit_Framework_TestCase
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@@ -205,7 +205,7 @@ class ConditionEvaluatorTest extends \PHPUnit_Framework_TestCase
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@@ -292,7 +292,7 @@ class ConditionEvaluatorTest extends \PHPUnit_Framework_TestCase
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Thelia\Condition\Implementation;
|
||||
use Thelia\Condition\ConditionEvaluator;
|
||||
use Thelia\Condition\ConditionFactory;
|
||||
use Thelia\Condition\Operators;
|
||||
use Thelia\Coupon\AdapterInterface;
|
||||
use Thelia\Coupon\FacadeInterface;
|
||||
use Thelia\Coupon\ConditionCollection;
|
||||
use Thelia\Model\CurrencyQuery;
|
||||
|
||||
@@ -61,7 +61,7 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@@ -125,7 +125,7 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@@ -187,7 +187,7 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@@ -266,7 +266,7 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@@ -331,7 +331,7 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Thelia\Condition\Implementation;
|
||||
|
||||
use Thelia\Condition\ConditionEvaluator;
|
||||
use Thelia\Condition\Operators;
|
||||
use Thelia\Coupon\AdapterInterface;
|
||||
use Thelia\Coupon\FacadeInterface;
|
||||
use Thelia\Model\Currency;
|
||||
|
||||
/**
|
||||
@@ -41,7 +41,7 @@ use Thelia\Model\Currency;
|
||||
*/
|
||||
class MatchForEveryoneManagerTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/** @var AdapterInterface $stubTheliaAdapter */
|
||||
/** @var FacadeInterface $stubTheliaAdapter */
|
||||
protected $stubTheliaAdapter = null;
|
||||
|
||||
/**
|
||||
@@ -91,7 +91,7 @@ class MatchForEveryoneManagerTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
||||
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$condition1 = new MatchForEveryoneManager($stubAdapter);
|
||||
$operators = array();
|
||||
$values = array();
|
||||
@@ -114,7 +114,7 @@ class MatchForEveryoneManagerTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
||||
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$condition1 = new MatchForEveryoneManager($stubAdapter);
|
||||
|
||||
$isValid = $condition1->isMatching();
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Thelia\Condition\Implementation;
|
||||
|
||||
use Thelia\Condition\ConditionEvaluator;
|
||||
use Thelia\Condition\Operators;
|
||||
use Thelia\Coupon\AdapterInterface;
|
||||
use Thelia\Coupon\FacadeInterface;
|
||||
use Thelia\Exception\InvalidConditionValueException;
|
||||
use Thelia\Model\Currency;
|
||||
|
||||
@@ -42,7 +42,7 @@ use Thelia\Model\Currency;
|
||||
*/
|
||||
class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/** @var AdapterInterface $stubTheliaAdapter */
|
||||
/** @var FacadeInterface $stubTheliaAdapter */
|
||||
protected $stubTheliaAdapter = null;
|
||||
|
||||
/**
|
||||
@@ -102,7 +102,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
||||
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
$operators = array(
|
||||
MatchForTotalAmountManager::INPUT1 => Operators::IN,
|
||||
@@ -131,7 +131,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
||||
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
$operators = array(
|
||||
MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR,
|
||||
@@ -158,7 +158,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testInValidBackOfficeInputValue()
|
||||
{
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
@@ -187,7 +187,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testInValidBackOfficeInputValue2()
|
||||
{
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
@@ -215,7 +215,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testMatchingConditionInferior()
|
||||
{
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
@@ -243,7 +243,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testNotMatchingConditionInferior()
|
||||
{
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->generateAdapterStub(400, 'EUR');
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
@@ -271,7 +271,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testMatchingConditionInferiorEquals()
|
||||
{
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->generateAdapterStub(400, 'EUR');
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
@@ -299,7 +299,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testMatchingConditionInferiorEquals2()
|
||||
{
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
@@ -327,7 +327,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testNotMatchingConditionInferiorEquals()
|
||||
{
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->generateAdapterStub(401, 'EUR');
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
@@ -355,7 +355,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testMatchingConditionEqual()
|
||||
{
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->generateAdapterStub(400, 'EUR');
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
@@ -383,7 +383,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testNotMatchingConditionEqual()
|
||||
{
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
@@ -411,7 +411,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testMatchingConditionSuperiorEquals()
|
||||
{
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->generateAdapterStub(401, 'EUR');
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
@@ -439,7 +439,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testMatchingConditionSuperiorEquals2()
|
||||
{
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->generateAdapterStub(400, 'EUR');
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
@@ -467,7 +467,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testNotMatchingConditionSuperiorEquals()
|
||||
{
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
@@ -495,7 +495,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testMatchingConditionSuperior()
|
||||
{
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->generateAdapterStub(401, 'EUR');
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
@@ -523,7 +523,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testNotMatchingConditionSuperior()
|
||||
{
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->generateAdapterStub(399, 'EUR');
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
@@ -551,7 +551,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testMatchingConditionCurrency()
|
||||
{
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->generateAdapterStub(400, 'EUR');
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
@@ -579,7 +579,7 @@ class MatchForTotalAmountManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testNotMatchingConditionCurrency()
|
||||
{
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->generateAdapterStub(400.00, 'EUR');
|
||||
|
||||
$condition1 = new MatchForTotalAmountManager($stubAdapter);
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Thelia\Condition\Implementation;
|
||||
use Thelia\Condition\ConditionEvaluator;
|
||||
use Thelia\Condition\Operators;
|
||||
use Thelia\Condition\SerializableCondition;
|
||||
use Thelia\Coupon\AdapterInterface;
|
||||
use Thelia\Coupon\FacadeInterface;
|
||||
|
||||
/**
|
||||
* Created by JetBrains PhpStorm.
|
||||
@@ -59,12 +59,12 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testInValidBackOfficeInputOperator()
|
||||
{
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter->expects($this->any())
|
||||
->method('getNbArticlesInCart')
|
||||
->will($this->returnValue(4));
|
||||
@@ -96,7 +96,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testInValidBackOfficeInputValue()
|
||||
{
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@@ -132,7 +132,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testMatchingRuleInferior()
|
||||
{
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@@ -168,7 +168,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testNotMatchingRuleInferior()
|
||||
{
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@@ -204,7 +204,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testMatchingRuleInferiorEquals()
|
||||
{
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@@ -240,7 +240,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testMatchingRuleInferiorEquals2()
|
||||
{
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@@ -276,7 +276,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testNotMatchingRuleInferiorEquals()
|
||||
{
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@@ -312,7 +312,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testMatchingRuleEqual()
|
||||
{
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@@ -348,7 +348,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testNotMatchingRuleEqual()
|
||||
{
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@@ -384,7 +384,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testMatchingRuleSuperiorEquals()
|
||||
{
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@@ -420,7 +420,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testMatchingRuleSuperiorEquals2()
|
||||
{
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@@ -456,7 +456,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testNotMatchingRuleSuperiorEquals()
|
||||
{
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@@ -492,7 +492,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testMatchingRuleSuperior()
|
||||
{
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@@ -528,7 +528,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testNotMatchingRuleSuperior()
|
||||
{
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@@ -558,7 +558,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testGetSerializableRule()
|
||||
{
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@@ -594,7 +594,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testGetAvailableOperators()
|
||||
{
|
||||
/** @var AdapterInterface $stubAdapter */
|
||||
/** @var FacadeInterface $stubAdapter */
|
||||
$stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@@ -632,7 +632,7 @@ class MatchForXArticlesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
// public function testGetValidators()
|
||||
// {
|
||||
// $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseAdapter')
|
||||
// $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
|
||||
// ->disableOriginalConstructor()
|
||||
// ->getMock();
|
||||
//
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Thelia\Coupon;
|
||||
* Date: 8/19/13
|
||||
* Time: 3:24 PM
|
||||
*
|
||||
* Unit Test BaseAdapter Class
|
||||
* Unit Test BaseFacade Class
|
||||
*
|
||||
* @package Coupon
|
||||
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
||||
@@ -44,7 +44,7 @@ class CouponBaseAdapterTest extends \PHPUnit_Framework_TestCase
|
||||
);
|
||||
}
|
||||
// /**
|
||||
// * @var BaseAdapter
|
||||
// * @var BaseFacade
|
||||
// */
|
||||
// protected $object;
|
||||
//
|
||||
@@ -54,7 +54,7 @@ class CouponBaseAdapterTest extends \PHPUnit_Framework_TestCase
|
||||
// */
|
||||
// protected function setUp()
|
||||
// {
|
||||
// $this->object = new BaseAdapter;
|
||||
// $this->object = new BaseFacade;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
@@ -66,7 +66,7 @@ class CouponBaseAdapterTest extends \PHPUnit_Framework_TestCase
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @covers Thelia\Coupon\BaseAdapter::getCart
|
||||
// * @covers Thelia\Coupon\BaseFacade::getCart
|
||||
// * @todo Implement testGetCart().
|
||||
// */
|
||||
// public function testGetCart()
|
||||
@@ -78,7 +78,7 @@ class CouponBaseAdapterTest extends \PHPUnit_Framework_TestCase
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @covers Thelia\Coupon\BaseAdapter::getDeliveryAddress
|
||||
// * @covers Thelia\Coupon\BaseFacade::getDeliveryAddress
|
||||
// * @todo Implement testGetDeliveryAddress().
|
||||
// */
|
||||
// public function testGetDeliveryAddress()
|
||||
@@ -90,7 +90,7 @@ class CouponBaseAdapterTest extends \PHPUnit_Framework_TestCase
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @covers Thelia\Coupon\BaseAdapter::getCustomer
|
||||
// * @covers Thelia\Coupon\BaseFacade::getCustomer
|
||||
// * @todo Implement testGetCustomer().
|
||||
// */
|
||||
// public function testGetCustomer()
|
||||
|
||||
@@ -23,14 +23,6 @@
|
||||
|
||||
namespace Thelia\Coupon;
|
||||
|
||||
use Thelia\Constraint\Validator\PriceParam;
|
||||
use Thelia\Constraint\Validator\RuleValidator;
|
||||
use Thelia\Constraint\Rule\AvailableForTotalAmount;
|
||||
use Thelia\Constraint\Rule\Operators;
|
||||
use Thelia\Coupon\Type\CouponInterface;
|
||||
use Thelia\Exception\CouponExpiredException;
|
||||
use Thelia\Model\Coupon;
|
||||
|
||||
require_once 'CouponManagerTest.php';
|
||||
|
||||
/**
|
||||
@@ -109,9 +101,9 @@ class CouponFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
// $isRemovingPostage
|
||||
// );
|
||||
//
|
||||
// /** @var AdapterInterface $stubCouponBaseAdapter */
|
||||
// /** @var FacadeInterface $stubCouponBaseAdapter */
|
||||
// $stubCouponBaseAdapter = $this->getMock(
|
||||
// 'Thelia\Coupon\BaseAdapter',
|
||||
// 'Thelia\Coupon\BaseFacade',
|
||||
// array('findOneCouponByCode'),
|
||||
// array()
|
||||
// );
|
||||
@@ -135,7 +127,7 @@ class CouponFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
// $date = new \DateTime();
|
||||
// $date->setTimestamp(strtotime("today - 2 months"));
|
||||
//
|
||||
// /** @var AdapterInterface $mockAdapter */
|
||||
// /** @var FacadeInterface $mockAdapter */
|
||||
// $mockAdapter = $this->generateCouponModelMock(null, null, null, null, null, null, null, null, $date);
|
||||
// $couponFactory = new CouponFactory($mockAdapter);
|
||||
// $coupon = $couponFactory->buildCouponFromCode('XMAS1');
|
||||
@@ -151,7 +143,7 @@ class CouponFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
// {
|
||||
// $date = new \DateTime();
|
||||
//
|
||||
// /** @var AdapterInterface $mockAdapter */
|
||||
// /** @var FacadeInterface $mockAdapter */
|
||||
// $mockAdapter = $this->generateCouponModelMock(null, null, null, null, null, null, null, null, $date);
|
||||
// $couponFactory = new CouponFactory($mockAdapter);
|
||||
// $coupon = $couponFactory->buildCouponFromCode('XMAS1');
|
||||
@@ -165,7 +157,7 @@ class CouponFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
// */
|
||||
// public function testBuildCouponFromCodeWithoutRule()
|
||||
// {
|
||||
// /** @var AdapterInterface $mockAdapter */
|
||||
// /** @var FacadeInterface $mockAdapter */
|
||||
// $mockAdapter = $this->generateCouponModelMock(null, null, null, null, null, null, null, null, null, new ConditionCollection(array()));
|
||||
// $couponFactory = new CouponFactory($mockAdapter);
|
||||
// $coupon = $couponFactory->buildCouponFromCode('XMAS1');
|
||||
@@ -178,7 +170,7 @@ class CouponFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
// */
|
||||
// public function testBuildCouponFromCode()
|
||||
// {
|
||||
// /** @var AdapterInterface $mockAdapter */
|
||||
// /** @var FacadeInterface $mockAdapter */
|
||||
// $mockAdapter = $this->generateCouponModelMock();
|
||||
// $couponFactory = new CouponFactory($mockAdapter);
|
||||
// /** @var CouponInterface $coupon */
|
||||
|
||||
@@ -23,11 +23,6 @@
|
||||
|
||||
namespace Thelia\Coupon;
|
||||
|
||||
use Thelia\Constraint\Validator\PriceParam;
|
||||
use Thelia\Constraint\Validator\RuleValidator;
|
||||
use Thelia\Constraint\Rule\Operators;
|
||||
use Thelia\Coupon\Type\CouponInterface;
|
||||
use Thelia\Tools\PhpUnitUtils;
|
||||
|
||||
/**
|
||||
* Created by JetBrains PhpStorm.
|
||||
@@ -88,7 +83,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
||||
// /** @var CouponInterface $coupon */
|
||||
// $coupon = self::generateValidCoupon();
|
||||
//
|
||||
// /** @var AdapterInterface $stubCouponBaseAdapter */
|
||||
// /** @var FacadeInterface $stubCouponBaseAdapter */
|
||||
// $stubCouponBaseAdapter = $this->generateFakeAdapter(array($coupon), $cartTotalPrice, $checkoutTotalPrice);
|
||||
//
|
||||
// $couponManager = new CouponManager($stubCouponBaseAdapter);
|
||||
@@ -108,7 +103,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
||||
// */
|
||||
// public function testGetDiscountTwoCoupon()
|
||||
// {
|
||||
// $adapter = new BaseAdapter();
|
||||
// $adapter = new BaseFacade();
|
||||
// $cartTotalPrice = 100.00;
|
||||
// $checkoutTotalPrice = 120.00;
|
||||
//
|
||||
@@ -128,7 +123,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
||||
// /** @var CouponInterface $coupon2 */
|
||||
// $coupon2 = $this->generateValidCoupon('XMAS2', null, null, null, 15.00, null, null, $rules);
|
||||
//
|
||||
// /** @var AdapterInterface $stubCouponBaseAdapter */
|
||||
// /** @var FacadeInterface $stubCouponBaseAdapter */
|
||||
// $stubCouponBaseAdapter = $this->generateFakeAdapter(array($coupon1, $coupon2), $cartTotalPrice, $checkoutTotalPrice);
|
||||
//
|
||||
// $couponManager = new CouponManager($stubCouponBaseAdapter);
|
||||
@@ -148,7 +143,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
||||
// */
|
||||
// public function testGetDiscountAlwaysInferiorToPrice()
|
||||
// {
|
||||
// $adapter = new BaseAdapter();
|
||||
// $adapter = new BaseFacade();
|
||||
// $cartTotalPrice = 21.00;
|
||||
// $checkoutTotalPrice = 26.00;
|
||||
//
|
||||
@@ -166,7 +161,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
||||
// /** @var CouponInterface $coupon */
|
||||
// $coupon = $this->generateValidCoupon('XMAS2', null, null, null, 30.00, null, null, $rules);
|
||||
//
|
||||
// /** @var AdapterInterface $stubCouponBaseAdapter */
|
||||
// /** @var FacadeInterface $stubCouponBaseAdapter */
|
||||
// $stubCouponBaseAdapter = $this->generateFakeAdapter(array($coupon), $cartTotalPrice, $checkoutTotalPrice);
|
||||
//
|
||||
// $couponManager = new CouponManager($stubCouponBaseAdapter);
|
||||
@@ -185,7 +180,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
||||
// */
|
||||
// public function testIsCouponRemovingPostage()
|
||||
// {
|
||||
// $adapter = new BaseAdapter();
|
||||
// $adapter = new BaseFacade();
|
||||
// $cartTotalPrice = 21.00;
|
||||
// $checkoutTotalPrice = 27.00;
|
||||
//
|
||||
@@ -203,7 +198,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
||||
// /** @var CouponInterface $coupon */
|
||||
// $coupon = $this->generateValidCoupon('XMAS2', null, null, null, 30.00, null, null, $rules, null, true);
|
||||
//
|
||||
// /** @var AdapterInterface $stubCouponBaseAdapter */
|
||||
// /** @var FacadeInterface $stubCouponBaseAdapter */
|
||||
// $stubCouponBaseAdapter = $this->generateFakeAdapter(array($coupon), $cartTotalPrice, $checkoutTotalPrice);
|
||||
//
|
||||
// $couponManager = new CouponManager($stubCouponBaseAdapter);
|
||||
@@ -231,7 +226,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
||||
//
|
||||
// $coupons = array($couponCumulative1);
|
||||
//
|
||||
// /** @var AdapterInterface $stubCouponBaseAdapter */
|
||||
// /** @var FacadeInterface $stubCouponBaseAdapter */
|
||||
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
||||
//
|
||||
// // When
|
||||
@@ -264,7 +259,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
||||
// $couponCumulative1 = $this->generateValidCoupon(null, null, null, null, null, null, null, null, true);
|
||||
//
|
||||
// $coupons = array($couponCumulative1);
|
||||
// /** @var AdapterInterface $stubCouponBaseAdapter */
|
||||
// /** @var FacadeInterface $stubCouponBaseAdapter */
|
||||
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
||||
//
|
||||
// // When
|
||||
@@ -299,7 +294,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
||||
// $couponCumulative2 = $this->generateValidCoupon('XMAS2', null, null, null, null, null, null, null, true);
|
||||
//
|
||||
// $coupons = array($couponCumulative1, $couponCumulative2);
|
||||
// /** @var AdapterInterface $stubCouponBaseAdapter */
|
||||
// /** @var FacadeInterface $stubCouponBaseAdapter */
|
||||
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
||||
//
|
||||
// // When
|
||||
@@ -334,7 +329,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
||||
// $couponCumulative2 = $this->generateValidCoupon('XMAS2', null, null, null, null, null, null, null, false);
|
||||
//
|
||||
// $coupons = array($couponCumulative1, $couponCumulative2);
|
||||
// /** @var AdapterInterface $stubCouponBaseAdapter */
|
||||
// /** @var FacadeInterface $stubCouponBaseAdapter */
|
||||
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
||||
//
|
||||
// // When
|
||||
@@ -369,7 +364,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
||||
// $couponCumulative2 = $this->generateValidCoupon('XMAS2', null, null, null, null, null, null, null, true);
|
||||
//
|
||||
// $coupons = array($couponCumulative1, $couponCumulative2);
|
||||
// /** @var AdapterInterface $stubCouponBaseAdapter */
|
||||
// /** @var FacadeInterface $stubCouponBaseAdapter */
|
||||
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
||||
//
|
||||
// // When
|
||||
@@ -404,7 +399,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
||||
// $couponCumulative2 = $this->generateValidCoupon('XMAS2', null, null, null, null, null, null, null, false);
|
||||
//
|
||||
// $coupons = array($couponCumulative1, $couponCumulative2);
|
||||
// /** @var AdapterInterface $stubCouponBaseAdapter */
|
||||
// /** @var FacadeInterface $stubCouponBaseAdapter */
|
||||
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
||||
//
|
||||
// // When
|
||||
@@ -437,7 +432,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
||||
// $couponCumulative1 = $this->generateValidCoupon('XMAS1', null, null, null, null, null, new \DateTime(), null, true);
|
||||
//
|
||||
// $coupons = array($couponCumulative1);
|
||||
// /** @var AdapterInterface $stubCouponBaseAdapter */
|
||||
// /** @var FacadeInterface $stubCouponBaseAdapter */
|
||||
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
||||
//
|
||||
// // When
|
||||
@@ -472,7 +467,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
||||
// $couponCumulative2 = $this->generateValidCoupon('XMAS2', null, null, null, null, null, new \DateTime(), null, true);
|
||||
//
|
||||
// $coupons = array($couponCumulative1, $couponCumulative2);
|
||||
// /** @var AdapterInterface $stubCouponBaseAdapter */
|
||||
// /** @var FacadeInterface $stubCouponBaseAdapter */
|
||||
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
||||
//
|
||||
// // When
|
||||
@@ -507,7 +502,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
||||
// $couponCumulative2 = $this->generateValidCoupon('XMAS2', null, null, null, null, null, null, null, true);
|
||||
//
|
||||
// $coupons = array($couponCumulative1, $couponCumulative2);
|
||||
// /** @var AdapterInterface $stubCouponBaseAdapter */
|
||||
// /** @var FacadeInterface $stubCouponBaseAdapter */
|
||||
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
||||
//
|
||||
// // When
|
||||
@@ -542,7 +537,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
||||
// $couponCumulative2 = $this->generateValidCoupon('XMAS2', null, null, null, null, null, new \DateTime(), null, true);
|
||||
//
|
||||
// $coupons = array($couponCumulative1, $couponCumulative2);
|
||||
// /** @var AdapterInterface $stubCouponBaseAdapter */
|
||||
// /** @var FacadeInterface $stubCouponBaseAdapter */
|
||||
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
||||
//
|
||||
// // When
|
||||
@@ -581,7 +576,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
||||
// $couponCumulative4 = $this->generateValidCoupon('XMAS4', null, null, null, null, null, null, null, true);
|
||||
//
|
||||
// $coupons = array($couponCumulative1, $couponCumulative2, $couponCumulative3, $couponCumulative4);
|
||||
// /** @var AdapterInterface $stubCouponBaseAdapter */
|
||||
// /** @var FacadeInterface $stubCouponBaseAdapter */
|
||||
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
||||
//
|
||||
// // When
|
||||
@@ -620,7 +615,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
||||
// $couponCumulative4 = $this->generateValidCoupon('XMAS4', null, null, null, null, null, null, null, false);
|
||||
//
|
||||
// $coupons = array($couponCumulative1, $couponCumulative2, $couponCumulative3, $couponCumulative4);
|
||||
// /** @var AdapterInterface $stubCouponBaseAdapter */
|
||||
// /** @var FacadeInterface $stubCouponBaseAdapter */
|
||||
// $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice);
|
||||
//
|
||||
// // When
|
||||
@@ -645,7 +640,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
||||
// */
|
||||
// public static function generateValidRules()
|
||||
// {
|
||||
// $adapter = new BaseAdapter();
|
||||
// $adapter = new BaseFacade();
|
||||
// $rule1 = new AvailableForTotalAmount(
|
||||
// $adapter, array(
|
||||
// AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator(
|
||||
@@ -692,7 +687,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
||||
// public function generateFakeAdapter(array $coupons, $cartTotalPrice, $checkoutTotalPrice, $postagePrice = 6.00)
|
||||
// {
|
||||
// $stubCouponBaseAdapter = $this->getMock(
|
||||
// 'Thelia\Coupon\BaseAdapter',
|
||||
// 'Thelia\Coupon\BaseFacade',
|
||||
// array(
|
||||
// 'getCurrentCoupons',
|
||||
// 'getCartTotalPrice',
|
||||
@@ -758,7 +753,7 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
|
||||
// $isAvailableOnSpecialOffers = null,
|
||||
// $maxUsage = null
|
||||
// ) {
|
||||
// $adapter = new BaseAdapter();
|
||||
// $adapter = new BaseFacade();
|
||||
// if ($code === null) {
|
||||
// $code = self::VALID_CODE;
|
||||
// }
|
||||
|
||||
@@ -23,10 +23,6 @@
|
||||
|
||||
namespace Thelia\Coupon;
|
||||
|
||||
use Thelia\Constraint\Validator\PriceParam;
|
||||
use Thelia\Constraint\Validator\RuleValidator;
|
||||
use Thelia\Constraint\Rule\Operators;
|
||||
use Thelia\Coupon\Type\RemoveXAmountManager;
|
||||
|
||||
//require_once '../CouponManagerTest.php';
|
||||
|
||||
@@ -153,7 +149,7 @@ class RemoveXAmountTest extends \PHPUnit_Framework_TestCase
|
||||
// */
|
||||
// public function testGetEffect()
|
||||
// {
|
||||
// $adapter = new BaseAdapter();
|
||||
// $adapter = new BaseFacade();
|
||||
// $coupon = CouponManagerTest::generateValidCoupon(null, null, null, null, null, null, null, null, false, false);
|
||||
//
|
||||
// $expected = 10;
|
||||
@@ -228,7 +224,7 @@ class RemoveXAmountTest extends \PHPUnit_Framework_TestCase
|
||||
// public function testGetEffectIfTotalAmountInferiorTo400Valid()
|
||||
// {
|
||||
// // Given
|
||||
// $adapter = new BaseAdapter();
|
||||
// $adapter = new BaseFacade();
|
||||
// $rule0 = $this->generateValidRuleAvailableForTotalAmountOperatorTo(
|
||||
// Operators::INFERIOR,
|
||||
// 400.00
|
||||
@@ -253,7 +249,7 @@ class RemoveXAmountTest extends \PHPUnit_Framework_TestCase
|
||||
// public function testGetEffectIfTotalAmountInferiorOrEqualTo400Valid()
|
||||
// {
|
||||
// // Given
|
||||
// $adapter = new BaseAdapter();
|
||||
// $adapter = new BaseFacade();
|
||||
// $rule0 = $this->generateValidRuleAvailableForTotalAmountOperatorTo(
|
||||
// Operators::INFERIOR_OR_EQUAL,
|
||||
// 400.00
|
||||
@@ -278,7 +274,7 @@ class RemoveXAmountTest extends \PHPUnit_Framework_TestCase
|
||||
// public function testGetEffectIfTotalAmountEqualTo400Valid()
|
||||
// {
|
||||
// // Given
|
||||
// $adapter = new BaseAdapter();
|
||||
// $adapter = new BaseFacade();
|
||||
// $rule0 = $this->generateValidRuleAvailableForTotalAmountOperatorTo(
|
||||
// Operators::EQUAL,
|
||||
// 400.00
|
||||
@@ -303,7 +299,7 @@ class RemoveXAmountTest extends \PHPUnit_Framework_TestCase
|
||||
// public function testGetEffectIfTotalAmountSuperiorOrEqualTo400Valid()
|
||||
// {
|
||||
// // Given
|
||||
// $adapter = new BaseAdapter();
|
||||
// $adapter = new BaseFacade();
|
||||
// $rule0 = $this->generateValidRuleAvailableForTotalAmountOperatorTo(
|
||||
// Operators::SUPERIOR_OR_EQUAL,
|
||||
// 400.00
|
||||
@@ -328,7 +324,7 @@ class RemoveXAmountTest extends \PHPUnit_Framework_TestCase
|
||||
// public function testGetEffectIfTotalAmountSuperiorTo400Valid()
|
||||
// {
|
||||
// // Given
|
||||
// $adapter = new BaseAdapter();
|
||||
// $adapter = new BaseFacade();
|
||||
// $rule0 = $this->generateValidRuleAvailableForTotalAmountOperatorTo(
|
||||
// Operators::SUPERIOR,
|
||||
// 400.00
|
||||
@@ -365,7 +361,7 @@ class RemoveXAmountTest extends \PHPUnit_Framework_TestCase
|
||||
// */
|
||||
// protected function generateValidRuleAvailableForTotalAmountOperatorTo($operator, $amount)
|
||||
// {
|
||||
// $adapter = new BaseAdapter();
|
||||
// $adapter = new BaseFacade();
|
||||
// $validators = array(
|
||||
// AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator(
|
||||
// $operator,
|
||||
|
||||
@@ -24,11 +24,6 @@
|
||||
namespace Thelia\Coupon;
|
||||
|
||||
use PHPUnit_Framework_TestCase;
|
||||
use Thelia\Constraint\Rule\Operators;
|
||||
use Thelia\Constraint\Validator\PriceParam;
|
||||
use Thelia\Constraint\Validator\RuleValidator;
|
||||
use Thelia\Coupon\Type\CouponInterface;
|
||||
use Thelia\Coupon\Type\RemoveXPercentManager;
|
||||
|
||||
//require_once '../CouponManagerTest.php';
|
||||
|
||||
@@ -407,7 +402,7 @@ class RemoveXPercentTest extends \PHPUnit_Framework_TestCase
|
||||
// */
|
||||
// protected function generateValidRuleAvailableForTotalAmountOperatorTo($operator, $amount)
|
||||
// {
|
||||
// $adapter = new BaseAdapter();
|
||||
// $adapter = new BaseFacade();
|
||||
// $validators = array(
|
||||
// AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator(
|
||||
// $operator,
|
||||
@@ -432,7 +427,7 @@ class RemoveXPercentTest extends \PHPUnit_Framework_TestCase
|
||||
// public function generateFakeAdapter($cartTotalPrice)
|
||||
// {
|
||||
// $stubCouponBaseAdapter = $this->getMock(
|
||||
// 'Thelia\Coupon\BaseAdapter',
|
||||
// 'Thelia\Coupon\BaseFacade',
|
||||
// array(
|
||||
// 'getCartTotalPrice'
|
||||
// ),
|
||||
|
||||
@@ -5,7 +5,7 @@ use Thelia\Condition\Implementation\MatchForEveryoneManager;
|
||||
use Thelia\Condition\Implementation\MatchForTotalAmountManager;
|
||||
use Thelia\Condition\Implementation\MatchForXArticlesManager;
|
||||
use Thelia\Condition\Operators;
|
||||
use Thelia\Coupon\AdapterInterface;
|
||||
use Thelia\Coupon\FacadeInterface;
|
||||
use Thelia\Coupon\ConditionCollection;
|
||||
|
||||
|
||||
@@ -644,7 +644,7 @@ function generateCouponFixtures(\Thelia\Core\Thelia $thelia)
|
||||
{
|
||||
/** @var $container ContainerInterface Service Container */
|
||||
$container = $thelia->getContainer();
|
||||
/** @var AdapterInterface $adapter */
|
||||
/** @var FacadeInterface $adapter */
|
||||
$adapter = $container->get('thelia.adapter');
|
||||
|
||||
// Coupons
|
||||
|
||||
0
web/cache/.gitkeep
vendored
Normal file → Executable file
0
web/cache/.gitkeep
vendored
Normal file → Executable file
Reference in New Issue
Block a user