diff --git a/core/lib/Thelia/Core/Template/Element/BaseI18nLoop.php b/core/lib/Thelia/Core/Template/Element/BaseI18nLoop.php index 18eadce3c..792389b1c 100644 --- a/core/lib/Thelia/Core/Template/Element/BaseI18nLoop.php +++ b/core/lib/Thelia/Core/Template/Element/BaseI18nLoop.php @@ -59,11 +59,12 @@ abstract class BaseI18nLoop extends BaseLoop * @param array $columns the i18n columns * @param string $foreignTable the specified table (default to criteria table) * @param string $foreignKey the foreign key in this table (default to criteria table) + * @param bool $forceReturn * * @return mixed the locale */ - protected function configureI18nProcessing(ModelCriteria $search, $columns = array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM'), $foreignTable = null, $foreignKey = 'ID', $forceReturn = false) { - + protected function configureI18nProcessing(ModelCriteria $search, $columns = array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM'), $foreignTable = null, $foreignKey = 'ID', $forceReturn = false) + { /* manage translations */ return ModelCriteriaTools::getI18n( $this->getBackend_context(), diff --git a/core/lib/Thelia/Tests/Core/Template/Element/BaseLoopTestor.php b/core/lib/Thelia/Tests/Core/Template/Element/BaseLoopTestor.php index 7d14fbbc5..4a9cb4158 100755 --- a/core/lib/Thelia/Tests/Core/Template/Element/BaseLoopTestor.php +++ b/core/lib/Thelia/Tests/Core/Template/Element/BaseLoopTestor.php @@ -23,6 +23,7 @@ namespace Thelia\Tests\Core\Template\Element; +use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\EventDispatcher\EventDispatcher; use Thelia\Core\HttpFoundation\Request; use Thelia\Core\Security\SecurityContext; @@ -34,11 +35,9 @@ use Thelia\Core\HttpFoundation\Session\Session; * @author Etienne Roudeix * */ -abstract class BaseLoopTestor extends \Thelia\Tests\TestCaseWithURLToolSetup +abstract class BaseLoopTestor extends \PHPUnit_Framework_TestCase { - protected $request; - protected $dispatcher; - protected $securityContext; + protected $container; protected $instance; @@ -57,12 +56,35 @@ abstract class BaseLoopTestor extends \Thelia\Tests\TestCaseWithURLToolSetup public function setUp() { - $this->request = new Request(); + $this->container = new ContainerBuilder(); + + $session = new Session(new MockArraySessionStorage()); + $request = new Request(); + + $request->setSession($session); + + /*$stubEventdispatcher = $this->getMockBuilder('\Symfony\Component\EventDispatcher\EventDispatcher') + ->disableOriginalConstructor() + ->getMock(); + + $stubSecurityContext = $this->getMockBuilder('\Thelia\Core\Security\SecurityContext') + ->disableOriginalConstructor() + ->getMock();*/ + + /*$stubAdapter->expects($this->any()) + ->method('getTranslator') + ->will($this->returnValue($stubTranslator));*/ + + /*$this->request = new Request(); $this->request->setSession(new Session(new MockArraySessionStorage())); $this->dispatcher = new EventDispatcher(); - $this->securityContext = new SecurityContext($this->request); + $this->securityContext = new SecurityContext($this->request);*/ + + $this->container->set('request', $request); + $this->container->set('event_dispatcher', new EventDispatcher()); + $this->container->set('thelia.securityContext', new SecurityContext($request)); $this->instance = $this->getTestedInstance(); $this->instance->initializeArgs($this->getMandatoryArguments()); diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/AccessoryTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/AccessoryTest.php index 99f5a0310..64bd4b5b6 100755 --- a/core/lib/Thelia/Tests/Core/Template/Loop/AccessoryTest.php +++ b/core/lib/Thelia/Tests/Core/Template/Loop/AccessoryTest.php @@ -41,7 +41,7 @@ class AccessoryTest extends BaseLoopTestor public function getTestedInstance() { - return new Accessory($this->request, $this->dispatcher, $this->securityContext); + return new Accessory($this->container); } public function getMandatoryArguments() diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/AddressTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/AddressTest.php index 7ca5c094b..447646b8b 100755 --- a/core/lib/Thelia/Tests/Core/Template/Loop/AddressTest.php +++ b/core/lib/Thelia/Tests/Core/Template/Loop/AddressTest.php @@ -41,7 +41,7 @@ class AddressTest extends BaseLoopTestor public function getTestedInstance() { - return new Address($this->request, $this->dispatcher, $this->securityContext); + return new Address($this->container); } public function getMandatoryArguments() diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/AssociatedContentTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/AssociatedContentTest.php index 0a12ad076..5d6c2579c 100755 --- a/core/lib/Thelia/Tests/Core/Template/Loop/AssociatedContentTest.php +++ b/core/lib/Thelia/Tests/Core/Template/Loop/AssociatedContentTest.php @@ -41,7 +41,7 @@ class AssociatedContentTest extends BaseLoopTestor public function getTestedInstance() { - return new AssociatedContent($this->request, $this->dispatcher, $this->securityContext); + return new AssociatedContent($this->container); } public function getMandatoryArguments() diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/AttributeAvailabilityTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/AttributeAvailabilityTest.php index c870f32ef..ca880daa8 100755 --- a/core/lib/Thelia/Tests/Core/Template/Loop/AttributeAvailabilityTest.php +++ b/core/lib/Thelia/Tests/Core/Template/Loop/AttributeAvailabilityTest.php @@ -41,7 +41,7 @@ class AttributeAvailabilityTest extends BaseLoopTestor public function getTestedInstance() { - return new AttributeAvailability($this->request, $this->dispatcher, $this->securityContext); + return new AttributeAvailability($this->container); } public function getMandatoryArguments() diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/AttributeCombinationTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/AttributeCombinationTest.php index 98d0575eb..f811c7de9 100755 --- a/core/lib/Thelia/Tests/Core/Template/Loop/AttributeCombinationTest.php +++ b/core/lib/Thelia/Tests/Core/Template/Loop/AttributeCombinationTest.php @@ -41,7 +41,7 @@ class AttributeCombinationTest extends BaseLoopTestor public function getTestedInstance() { - return new AttributeCombination($this->request, $this->dispatcher, $this->securityContext); + return new AttributeCombination($this->container); } public function getMandatoryArguments() diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/AttributeTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/AttributeTest.php index 653de34e9..46b19e3ac 100755 --- a/core/lib/Thelia/Tests/Core/Template/Loop/AttributeTest.php +++ b/core/lib/Thelia/Tests/Core/Template/Loop/AttributeTest.php @@ -41,7 +41,7 @@ class AttributeTest extends BaseLoopTestor public function getTestedInstance() { - return new Attribute($this->request, $this->dispatcher, $this->securityContext); + return new Attribute($this->container); } public function getMandatoryArguments() diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/CategoryTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/CategoryTest.php index f33d07868..a2a320693 100755 --- a/core/lib/Thelia/Tests/Core/Template/Loop/CategoryTest.php +++ b/core/lib/Thelia/Tests/Core/Template/Loop/CategoryTest.php @@ -41,7 +41,7 @@ class CategoryTest extends BaseLoopTestor public function getTestedInstance() { - return new Category($this->request, $this->dispatcher, $this->securityContext); + return new Category($this->container); } public function getMandatoryArguments() diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/ContentTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/ContentTest.php index 71922dbab..b6f9d0e3d 100755 --- a/core/lib/Thelia/Tests/Core/Template/Loop/ContentTest.php +++ b/core/lib/Thelia/Tests/Core/Template/Loop/ContentTest.php @@ -41,7 +41,7 @@ class ContentTest extends BaseLoopTestor public function getTestedInstance() { - return new Content($this->request, $this->dispatcher, $this->securityContext); + return new Content($this->container); } public function getMandatoryArguments() diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/CountryTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/CountryTest.php index 389d0bc5d..0eb37a6fd 100755 --- a/core/lib/Thelia/Tests/Core/Template/Loop/CountryTest.php +++ b/core/lib/Thelia/Tests/Core/Template/Loop/CountryTest.php @@ -41,7 +41,7 @@ class CountryTest extends BaseLoopTestor public function getTestedInstance() { - return new Country($this->request, $this->dispatcher, $this->securityContext); + return new Country($this->container); } public function getMandatoryArguments() diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/CurrencyTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/CurrencyTest.php index 95dd5a5c6..a866fae0c 100755 --- a/core/lib/Thelia/Tests/Core/Template/Loop/CurrencyTest.php +++ b/core/lib/Thelia/Tests/Core/Template/Loop/CurrencyTest.php @@ -41,7 +41,7 @@ class CurrencyTest extends BaseLoopTestor public function getTestedInstance() { - return new Currency($this->request, $this->dispatcher, $this->securityContext); + return new Currency($this->container); } public function getMandatoryArguments() diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/CustomerTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/CustomerTest.php index 62bcaa3be..4239414fa 100755 --- a/core/lib/Thelia/Tests/Core/Template/Loop/CustomerTest.php +++ b/core/lib/Thelia/Tests/Core/Template/Loop/CustomerTest.php @@ -41,7 +41,7 @@ class CustomerTest extends BaseLoopTestor public function getTestedInstance() { - return new Customer($this->request, $this->dispatcher, $this->securityContext); + return new Customer($this->container); } public function getMandatoryArguments() diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/FeatureAvailabilityTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/FeatureAvailabilityTest.php index d3a045f33..aae4ec254 100755 --- a/core/lib/Thelia/Tests/Core/Template/Loop/FeatureAvailabilityTest.php +++ b/core/lib/Thelia/Tests/Core/Template/Loop/FeatureAvailabilityTest.php @@ -41,7 +41,7 @@ class FeatureAvailabilityTest extends BaseLoopTestor public function getTestedInstance() { - return new FeatureAvailability($this->request, $this->dispatcher, $this->securityContext); + return new FeatureAvailability($this->container); } public function getMandatoryArguments() diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/FeatureTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/FeatureTest.php index 155088173..7324856f6 100755 --- a/core/lib/Thelia/Tests/Core/Template/Loop/FeatureTest.php +++ b/core/lib/Thelia/Tests/Core/Template/Loop/FeatureTest.php @@ -41,7 +41,7 @@ class FeatureTest extends BaseLoopTestor public function getTestedInstance() { - return new Feature($this->request, $this->dispatcher, $this->securityContext); + return new Feature($this->container); } public function getMandatoryArguments() diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/FeatureValueTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/FeatureValueTest.php index 3f6a14a16..19966ba71 100755 --- a/core/lib/Thelia/Tests/Core/Template/Loop/FeatureValueTest.php +++ b/core/lib/Thelia/Tests/Core/Template/Loop/FeatureValueTest.php @@ -41,7 +41,7 @@ class FeatureValueTest extends BaseLoopTestor public function getTestedInstance() { - return new FeatureValue($this->request, $this->dispatcher, $this->securityContext); + return new FeatureValue($this->container); } public function getMandatoryArguments() diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/FolderTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/FolderTest.php index 2505c2fc2..2388a86c0 100755 --- a/core/lib/Thelia/Tests/Core/Template/Loop/FolderTest.php +++ b/core/lib/Thelia/Tests/Core/Template/Loop/FolderTest.php @@ -41,7 +41,7 @@ class FolderTest extends BaseLoopTestor public function getTestedInstance() { - return new Folder($this->request, $this->dispatcher, $this->securityContext); + return new Folder($this->container); } public function getMandatoryArguments() diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/ProductSaleElementTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/ProductSaleElementTest.php index 612519e04..d8ed243ca 100755 --- a/core/lib/Thelia/Tests/Core/Template/Loop/ProductSaleElementTest.php +++ b/core/lib/Thelia/Tests/Core/Template/Loop/ProductSaleElementTest.php @@ -41,7 +41,7 @@ class ProductSaleElementsTest extends BaseLoopTestor public function getTestedInstance() { - return new ProductSaleElements($this->request, $this->dispatcher, $this->securityContext); + return new ProductSaleElements($this->container); } public function getMandatoryArguments() diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/ProductTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/ProductTest.php index 1ac5cb3b3..8fc7d5ae5 100755 --- a/core/lib/Thelia/Tests/Core/Template/Loop/ProductTest.php +++ b/core/lib/Thelia/Tests/Core/Template/Loop/ProductTest.php @@ -32,7 +32,7 @@ use Thelia\Core\Template\Loop\Product; * @author Etienne Roudeix * */ -/*class ProductTest extends BaseLoopTestor +class ProductTest extends BaseLoopTestor { public function getTestedClassName() { @@ -41,11 +41,11 @@ use Thelia\Core\Template\Loop\Product; public function getTestedInstance() { - return new Product($this->request, $this->dispatcher, $this->securityContext); + return new Product($this->container); } public function getMandatoryArguments() { return array(); } -}*/ +} diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/TitleTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/TitleTest.php index 392e97930..63e4a7a9a 100755 --- a/core/lib/Thelia/Tests/Core/Template/Loop/TitleTest.php +++ b/core/lib/Thelia/Tests/Core/Template/Loop/TitleTest.php @@ -41,7 +41,7 @@ class TitleTest extends BaseLoopTestor public function getTestedInstance() { - return new Title($this->request, $this->dispatcher, $this->securityContext); + return new Title($this->container); } public function getMandatoryArguments()