Revert "Revert "Merge branch 'cleanmaster' into modules""

This reverts commit b3ac365b45.

Conflicts:
	Readme.md
	core/lib/Thelia/Controller/Admin/AbstractCrudController.php
	core/lib/Thelia/Core/Template/Assets/AssetManagerInterface.php
	core/lib/Thelia/Core/Template/Assets/AsseticAssetManager.php
	core/lib/Thelia/Core/Template/Smarty/SmartyParser.php
	core/lib/Thelia/Core/Template/TemplateDefinition.php
	core/lib/Thelia/Model/Base/Coupon.php
	core/lib/Thelia/Model/Base/CouponQuery.php
	core/lib/Thelia/Model/Base/CouponVersion.php
	core/lib/Thelia/Model/Base/CouponVersionQuery.php
	core/lib/Thelia/Model/Base/OrderCouponQuery.php
This commit is contained in:
Etienne Roudeix
2014-01-06 11:25:25 +01:00
parent d4582f467f
commit 99038e688a
327 changed files with 3728 additions and 3732 deletions

View File

@@ -47,7 +47,7 @@ class ContentTest extends TestCaseWithURLToolSetup
public function getUpdateEvent(&$content)
{
if(!$content instanceof \Thelia\Model\Content) {
if (!$content instanceof \Thelia\Model\Content) {
$content = $this->getRandomContent();
}

View File

@@ -45,7 +45,7 @@ class FolderTest extends TestCaseWithURLToolSetup
public function getUpdateEvent(&$folder)
{
if(!$folder instanceof \Thelia\Model\Folder) {
if (!$folder instanceof \Thelia\Model\Folder) {
$folder = $this->getRandomFolder();
}
@@ -65,7 +65,7 @@ class FolderTest extends TestCaseWithURLToolSetup
public function getUpdateSeoEvent(&$folder)
{
if(!$folder instanceof \Thelia\Model\Folder) {
if (!$folder instanceof \Thelia\Model\Folder) {
$folder = $this->getRandomFolder();
}
@@ -83,6 +83,7 @@ class FolderTest extends TestCaseWithURLToolSetup
public function processUpdateSeoAction($event)
{
$contentAction = new Folder($this->getContainer());
return $contentAction->updateSeo($event);
}
@@ -223,7 +224,7 @@ class FolderTest extends TestCaseWithURLToolSetup
->findOne();
if (null === $nextFolder) {
$this->fail('use fixtures before launching test, there is no folder in database');
$this->fail('use fixtures before launching test, there is not enough folder in database');
}
$folder = FolderQuery::create()

View File

@@ -24,7 +24,6 @@
namespace Thelia\Tests\Action;
use Propel\Runtime\ActiveQuery\Criteria;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
use Thelia\Core\Event\Order\OrderAddressEvent;
use Thelia\Core\Event\Order\OrderEvent;

View File

@@ -37,7 +37,7 @@ trait RewrittenUrlTestTrait
->filterByView(ConfigQuery::getObsoleteRewrittenUrlView(), Criteria::NOT_EQUAL)
->findOne();
if(null === $existingUrl) {
if (null === $existingUrl) {
$this->fail('use fixtures before launching test, there is not enough rewritten url');
}
@@ -55,12 +55,12 @@ trait RewrittenUrlTestTrait
/* get a brand new URL */
$exist = true;
while(true === $exist) {
while (true === $exist) {
$newUrl = md5(rand(1, 999999)) . ".html";
try {
new RewritingResolver($newUrl);
} catch(UrlRewritingException $e) {
if($e->getCode() === UrlRewritingException::URL_NOT_FOUND) {
} catch (UrlRewritingException $e) {
if ($e->getCode() === UrlRewritingException::URL_NOT_FOUND) {
/* It's all good if URL is not found */
$exist = false;
} else {
@@ -91,9 +91,9 @@ trait RewrittenUrlTestTrait
try {
$aRandomProduct->setRewrittenUrl($aRandomProduct->getLocale(), $currentUrl);
$failReassign = false;
} catch(\Exception $e) {
} catch (\Exception $e) {
}
$this->assertFalse($failReassign);
}
}
}

View File

@@ -48,7 +48,6 @@ class ConditionCollectionTest extends \PHPUnit_Framework_TestCase
{
}
/**
* Generate adapter stub
*

View File

@@ -427,12 +427,10 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
->method('getContainer')
->will($this->returnValue($stubContainer));
$conditions = new ConditionCollection();
$conditionFactory = new ConditionFactory($stubContainer);
$conditionNone = new MatchForEveryone($stubFacade);
$expectedCollection = new ConditionCollection();
$expectedCollection[] = $conditionNone;

View File

@@ -193,6 +193,5 @@ class MatchForEveryoneTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($expected1, $actual1);
$this->assertEquals($expected2, $actual2);
}
}

View File

@@ -629,7 +629,6 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
->method('getAvailableCurrencies')
->will($this->returnValue($currencies));
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::EQUAL,
@@ -640,7 +639,6 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
MatchForTotalAmount::INPUT2 => 'UNK');
$condition1->setValidatorsFromForm($operators, $values);
$stubContainer = $this->getMockBuilder('\Symfony\Component\DependencyInjection\Container')
->disableOriginalConstructor()
->getMock();
@@ -696,7 +694,6 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
->method('getAvailableCurrencies')
->will($this->returnValue($currencies));
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::EQUAL,
@@ -707,7 +704,6 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
MatchForTotalAmount::INPUT2 => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$stubContainer = $this->getMockBuilder('\Symfony\Component\DependencyInjection\Container')
->disableOriginalConstructor()
->getMock();
@@ -763,7 +759,6 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
->method('getAvailableCurrencies')
->will($this->returnValue($currencies));
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::EQUAL,
@@ -774,7 +769,6 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
MatchForTotalAmount::INPUT2 => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$stubContainer = $this->getMockBuilder('\Symfony\Component\DependencyInjection\Container')
->disableOriginalConstructor()
->getMock();

View File

@@ -53,7 +53,7 @@ class CategoryTest extends BaseLoopTestor
public function testSearchById()
{
$category = CategoryQuery::create()->findOne();
if(null === $category) {
if (null === $category) {
$category = new \Thelia\Model\Category();
$category->setParent(0);
$category->setVisible(1);

View File

@@ -53,7 +53,7 @@ class ContentTest extends BaseLoopTestor
public function testSearchById()
{
$content = ContentQuery::create()->findOne();
if(null === $content) {
if (null === $content) {
$content = new \Thelia\Model\Content();
$content->setDefaultFolder(0);
$content->setVisible(1);

View File

@@ -53,7 +53,7 @@ class FolderTest extends BaseLoopTestor
public function testSearchById()
{
$folder = FolderQuery::create()->findOne();
if(null === $folder) {
if (null === $folder) {
$folder = new \Thelia\Model\Folder();
$folder->setParent(0);
$folder->setVisible(1);

View File

@@ -54,7 +54,7 @@ class ProductTest extends BaseLoopTestor
public function testSearchById()
{
$product = ProductQuery::create()->orderById(Criteria::ASC)->findOne();
if(null === $product) {
if (null === $product) {
$product = new \Thelia\Model\Product();
$product->setDefaultCategory(0);
$product->setVisible(1);

View File

@@ -53,7 +53,7 @@ class TaxRuleTest extends BaseLoopTestor
public function testSearchById()
{
$tr = TaxRuleQuery::create()->findOne();
if(null === $tr) {
if (null === $tr) {
$tr = new \Thelia\Model\TaxRule();
$tr->setTitle('foo');
$tr->save();

View File

@@ -152,7 +152,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
$serializedConditions = $conditionFactory->serializeConditionCollection($conditions);
$coupon1->setSerializedConditions($serializedConditions);
$coupon1->setMaxUsage(40);
$coupon1->setIsCumulative(true);
$coupon1->setIsRemovingPostage(false);
@@ -186,7 +185,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
$couponManager = new RemoveXAmount($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
@@ -219,7 +217,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
->method('unserializeConditionCollection')
->will($this->returnValue($conditions));
$stubContainer->expects($this->any())
->method('get')
->will($this->onConsecutiveCalls($stubFacade, $couponManager, $stubConditionFactory));
@@ -250,8 +247,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
$couponManager = new RemoveXAmount($stubFacade);
$stubContainer->expects($this->any())
->method('get')
->will($this->onConsecutiveCalls($stubFacade, $couponManager));
@@ -288,7 +283,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
$couponManager = new RemoveXAmount($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
@@ -321,7 +315,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
->method('unserializeConditionCollection')
->will($this->returnValue($conditions));
$stubContainer->expects($this->any())
->method('get')
->will($this->onConsecutiveCalls($stubFacade, $couponManager, $stubConditionFactory));
@@ -353,7 +346,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
$couponManager = new RemoveXAmount($stubFacade);
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
@@ -384,7 +376,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
->method('unserializeConditionCollection')
->will($this->returnValue($conditions));
$stubContainer->expects($this->any())
->method('get')
->will($this->onConsecutiveCalls($stubFacade, $couponManager, $stubConditionFactory));

View File

@@ -58,7 +58,6 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase
{
}
/**
* Generate a valid Coupon model
*/
@@ -114,7 +113,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
$serializedConditions = $conditionFactory->serializeConditionCollection($conditions);
$coupon1->setSerializedConditions($serializedConditions);
$coupon1->setMaxUsage(40);
$coupon1->setIsCumulative(true);
$coupon1->setIsRemovingPostage(true);
@@ -154,7 +152,7 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
$couponFactory = new CouponFactory($stubContainer);
$model1 = $this->generateCouponModel($stubFacade, $conditionFactory);
$model1->setAmount(21.00);
$model1->setCode('XMAS')->setIsRemovingPostage(false)->setAmount(21.00);
$coupon1 = $couponFactory->buildCouponFromModel($model1);
$model2 = $this->generateCouponModel($stubFacade, $conditionFactory);
@@ -172,12 +170,16 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
->will($this->returnValue(122.53));
$couponManager = new CouponManager($stubContainer);
$couponManager->addAvailableCoupon($coupon1);
$couponManager->addAvailableCoupon($coupon2);
$actual = $couponManager->getDiscount();
$expected = 50.80;
$expected = 21 + 21.50;
$this->assertEquals($expected, $actual);
$this->assertTrue($couponManager->isCouponRemovingPostage());
}
/**
@@ -303,8 +305,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
$conditionFactory = new ConditionFactory($stubContainer);
$stubFacade->expects($this->any())
->method('getCurrentCoupons')
->will($this->returnValue(array()));
@@ -330,7 +330,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
$coupon1 = $couponFactory->buildCouponFromModel($model1);
$coupon2 = clone $coupon1;
$couponManager = new CouponManager($stubContainer);
$couponManager->addAvailableCoupon($coupon1);
$couponManager->addAvailableCoupon($coupon2);
@@ -383,7 +382,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
->method('get')
->will($this->onConsecutiveCalls($stubFacade));
$couponManager = new CouponManager($stubContainer);
$couponManager->addAvailableCondition($condition1);
$couponManager->addAvailableCondition($condition2);
@@ -440,10 +438,8 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
->method('get')
->will($this->onConsecutiveCalls($stubFacade));
$couponManager = new CouponManager($stubContainer);
$stubModel = $this->getMockBuilder('\Thelia\Model\Coupon')
->disableOriginalConstructor()
->getMock();
@@ -507,10 +503,8 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
->method('get')
->will($this->onConsecutiveCalls($stubFacade));
$couponManager = new CouponManager($stubContainer);
$stubModel = $this->getMockBuilder('\Thelia\Model\Coupon')
->disableOriginalConstructor()
->getMock();

View File

@@ -23,7 +23,6 @@
namespace Thelia\Tests\Model;
use Thelia\Model\ConfigQuery;
use Symfony\Component\Filesystem\Filesystem;
use Thelia\Model\Message;
@@ -324,8 +323,8 @@ class MessageTest extends \PHPUnit_Framework_TestCase
$this->assertEquals("TEXT Layout 6: TEXT <template> & content v=my-value", $instance->getChildren()[0]->getBody());
}
protected function tearDown() {
protected function tearDown()
{
$dir = TemplateHelper::getInstance()->getActiveMailTemplate()->getAbsolutePath();
ConfigQuery::write('active-mail-template', $this->backup_mail_template);