fix tests
This commit is contained in:
@@ -59,11 +59,12 @@ abstract class BaseI18nLoop extends BaseLoop
|
|||||||
* @param array $columns the i18n columns
|
* @param array $columns the i18n columns
|
||||||
* @param string $foreignTable the specified table (default to criteria table)
|
* @param string $foreignTable the specified table (default to criteria table)
|
||||||
* @param string $foreignKey the foreign key in this 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
|
* @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 */
|
/* manage translations */
|
||||||
return ModelCriteriaTools::getI18n(
|
return ModelCriteriaTools::getI18n(
|
||||||
$this->getBackend_context(),
|
$this->getBackend_context(),
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
namespace Thelia\Tests\Core\Template\Element;
|
namespace Thelia\Tests\Core\Template\Element;
|
||||||
|
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||||
use Thelia\Core\HttpFoundation\Request;
|
use Thelia\Core\HttpFoundation\Request;
|
||||||
use Thelia\Core\Security\SecurityContext;
|
use Thelia\Core\Security\SecurityContext;
|
||||||
@@ -34,11 +35,9 @@ use Thelia\Core\HttpFoundation\Session\Session;
|
|||||||
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
abstract class BaseLoopTestor extends \Thelia\Tests\TestCaseWithURLToolSetup
|
abstract class BaseLoopTestor extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
protected $request;
|
protected $container;
|
||||||
protected $dispatcher;
|
|
||||||
protected $securityContext;
|
|
||||||
|
|
||||||
protected $instance;
|
protected $instance;
|
||||||
|
|
||||||
@@ -57,12 +56,35 @@ abstract class BaseLoopTestor extends \Thelia\Tests\TestCaseWithURLToolSetup
|
|||||||
|
|
||||||
public function setUp()
|
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->request->setSession(new Session(new MockArraySessionStorage()));
|
||||||
|
|
||||||
$this->dispatcher = new EventDispatcher();
|
$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 = $this->getTestedInstance();
|
||||||
$this->instance->initializeArgs($this->getMandatoryArguments());
|
$this->instance->initializeArgs($this->getMandatoryArguments());
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class AccessoryTest extends BaseLoopTestor
|
|||||||
|
|
||||||
public function getTestedInstance()
|
public function getTestedInstance()
|
||||||
{
|
{
|
||||||
return new Accessory($this->request, $this->dispatcher, $this->securityContext);
|
return new Accessory($this->container);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMandatoryArguments()
|
public function getMandatoryArguments()
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class AddressTest extends BaseLoopTestor
|
|||||||
|
|
||||||
public function getTestedInstance()
|
public function getTestedInstance()
|
||||||
{
|
{
|
||||||
return new Address($this->request, $this->dispatcher, $this->securityContext);
|
return new Address($this->container);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMandatoryArguments()
|
public function getMandatoryArguments()
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class AssociatedContentTest extends BaseLoopTestor
|
|||||||
|
|
||||||
public function getTestedInstance()
|
public function getTestedInstance()
|
||||||
{
|
{
|
||||||
return new AssociatedContent($this->request, $this->dispatcher, $this->securityContext);
|
return new AssociatedContent($this->container);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMandatoryArguments()
|
public function getMandatoryArguments()
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class AttributeAvailabilityTest extends BaseLoopTestor
|
|||||||
|
|
||||||
public function getTestedInstance()
|
public function getTestedInstance()
|
||||||
{
|
{
|
||||||
return new AttributeAvailability($this->request, $this->dispatcher, $this->securityContext);
|
return new AttributeAvailability($this->container);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMandatoryArguments()
|
public function getMandatoryArguments()
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class AttributeCombinationTest extends BaseLoopTestor
|
|||||||
|
|
||||||
public function getTestedInstance()
|
public function getTestedInstance()
|
||||||
{
|
{
|
||||||
return new AttributeCombination($this->request, $this->dispatcher, $this->securityContext);
|
return new AttributeCombination($this->container);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMandatoryArguments()
|
public function getMandatoryArguments()
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class AttributeTest extends BaseLoopTestor
|
|||||||
|
|
||||||
public function getTestedInstance()
|
public function getTestedInstance()
|
||||||
{
|
{
|
||||||
return new Attribute($this->request, $this->dispatcher, $this->securityContext);
|
return new Attribute($this->container);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMandatoryArguments()
|
public function getMandatoryArguments()
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class CategoryTest extends BaseLoopTestor
|
|||||||
|
|
||||||
public function getTestedInstance()
|
public function getTestedInstance()
|
||||||
{
|
{
|
||||||
return new Category($this->request, $this->dispatcher, $this->securityContext);
|
return new Category($this->container);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMandatoryArguments()
|
public function getMandatoryArguments()
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class ContentTest extends BaseLoopTestor
|
|||||||
|
|
||||||
public function getTestedInstance()
|
public function getTestedInstance()
|
||||||
{
|
{
|
||||||
return new Content($this->request, $this->dispatcher, $this->securityContext);
|
return new Content($this->container);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMandatoryArguments()
|
public function getMandatoryArguments()
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class CountryTest extends BaseLoopTestor
|
|||||||
|
|
||||||
public function getTestedInstance()
|
public function getTestedInstance()
|
||||||
{
|
{
|
||||||
return new Country($this->request, $this->dispatcher, $this->securityContext);
|
return new Country($this->container);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMandatoryArguments()
|
public function getMandatoryArguments()
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class CurrencyTest extends BaseLoopTestor
|
|||||||
|
|
||||||
public function getTestedInstance()
|
public function getTestedInstance()
|
||||||
{
|
{
|
||||||
return new Currency($this->request, $this->dispatcher, $this->securityContext);
|
return new Currency($this->container);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMandatoryArguments()
|
public function getMandatoryArguments()
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class CustomerTest extends BaseLoopTestor
|
|||||||
|
|
||||||
public function getTestedInstance()
|
public function getTestedInstance()
|
||||||
{
|
{
|
||||||
return new Customer($this->request, $this->dispatcher, $this->securityContext);
|
return new Customer($this->container);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMandatoryArguments()
|
public function getMandatoryArguments()
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class FeatureAvailabilityTest extends BaseLoopTestor
|
|||||||
|
|
||||||
public function getTestedInstance()
|
public function getTestedInstance()
|
||||||
{
|
{
|
||||||
return new FeatureAvailability($this->request, $this->dispatcher, $this->securityContext);
|
return new FeatureAvailability($this->container);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMandatoryArguments()
|
public function getMandatoryArguments()
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class FeatureTest extends BaseLoopTestor
|
|||||||
|
|
||||||
public function getTestedInstance()
|
public function getTestedInstance()
|
||||||
{
|
{
|
||||||
return new Feature($this->request, $this->dispatcher, $this->securityContext);
|
return new Feature($this->container);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMandatoryArguments()
|
public function getMandatoryArguments()
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class FeatureValueTest extends BaseLoopTestor
|
|||||||
|
|
||||||
public function getTestedInstance()
|
public function getTestedInstance()
|
||||||
{
|
{
|
||||||
return new FeatureValue($this->request, $this->dispatcher, $this->securityContext);
|
return new FeatureValue($this->container);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMandatoryArguments()
|
public function getMandatoryArguments()
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class FolderTest extends BaseLoopTestor
|
|||||||
|
|
||||||
public function getTestedInstance()
|
public function getTestedInstance()
|
||||||
{
|
{
|
||||||
return new Folder($this->request, $this->dispatcher, $this->securityContext);
|
return new Folder($this->container);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMandatoryArguments()
|
public function getMandatoryArguments()
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class ProductSaleElementsTest extends BaseLoopTestor
|
|||||||
|
|
||||||
public function getTestedInstance()
|
public function getTestedInstance()
|
||||||
{
|
{
|
||||||
return new ProductSaleElements($this->request, $this->dispatcher, $this->securityContext);
|
return new ProductSaleElements($this->container);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMandatoryArguments()
|
public function getMandatoryArguments()
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ use Thelia\Core\Template\Loop\Product;
|
|||||||
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*class ProductTest extends BaseLoopTestor
|
class ProductTest extends BaseLoopTestor
|
||||||
{
|
{
|
||||||
public function getTestedClassName()
|
public function getTestedClassName()
|
||||||
{
|
{
|
||||||
@@ -41,11 +41,11 @@ use Thelia\Core\Template\Loop\Product;
|
|||||||
|
|
||||||
public function getTestedInstance()
|
public function getTestedInstance()
|
||||||
{
|
{
|
||||||
return new Product($this->request, $this->dispatcher, $this->securityContext);
|
return new Product($this->container);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMandatoryArguments()
|
public function getMandatoryArguments()
|
||||||
{
|
{
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class TitleTest extends BaseLoopTestor
|
|||||||
|
|
||||||
public function getTestedInstance()
|
public function getTestedInstance()
|
||||||
{
|
{
|
||||||
return new Title($this->request, $this->dispatcher, $this->securityContext);
|
return new Title($this->container);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMandatoryArguments()
|
public function getMandatoryArguments()
|
||||||
|
|||||||
Reference in New Issue
Block a user