diff --git a/core/lib/Thelia/Core/Template/Loop/Image.php b/core/lib/Thelia/Core/Template/Loop/Image.php
index c85d41fc7..8d0c99400 100755
--- a/core/lib/Thelia/Core/Template/Loop/Image.php
+++ b/core/lib/Thelia/Core/Template/Loop/Image.php
@@ -175,7 +175,7 @@ class Image extends BaseI18nLoop
$source_id = $this->getSourceId();
$id = $this->getId();
- //echo "source = ".$this->getSource()."source_id=$source_id, id=$id
";
+ //echo "source = ".$this->getSourceId()."source_id=$source_id, id=$id
";
if (is_null($source_id) && is_null($id)) {
throw new \InvalidArgumentException("If 'source' argument is specified, 'id' or 'source_id' argument should be specified");
@@ -214,6 +214,7 @@ class Image extends BaseI18nLoop
*/
public function exec(&$pagination)
{
+
// Select the proper query to use, and get the object type
$object_type = $object_id = null;
@@ -262,13 +263,14 @@ class Image extends BaseI18nLoop
}
- //echo "sql=".$search->toString();
+ // echo "sql=".$search->toString();
$results = $this->search($search, $pagination);
$loopResult = new LoopResult($results);
foreach ($results as $result) {
+
// Create image processing event
$event = new ImageEvent($this->request);
@@ -315,7 +317,8 @@ class Image extends BaseI18nLoop
;
$loopResult->addRow($loopResultRow);
- } catch (\Exception $ex) {
+ }
+ catch (\Exception $ex) {
// Ignore the result and log an error
Tlog::getInstance()->addError("Failed to process image in image loop: ", $this->args);
}
diff --git a/core/lib/Thelia/Core/Template/Loop/TaxRule.php b/core/lib/Thelia/Core/Template/Loop/TaxRule.php
index a8ba3bf4a..5851f631d 100644
--- a/core/lib/Thelia/Core/Template/Loop/TaxRule.php
+++ b/core/lib/Thelia/Core/Template/Loop/TaxRule.php
@@ -31,11 +31,9 @@ use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument;
-use Thelia\Model\Base\CategoryQuery;
-use Thelia\Model\Base\ProductCategoryQuery;
-use Thelia\Model\Base\TaxRuleQuery;
use Thelia\Type\TypeCollection;
use Thelia\Type;
+use Thelia\Model\TaxRuleQuery;
/**
*
@@ -57,7 +55,8 @@ class TaxRule extends BaseI18nLoop
{
return new ArgumentCollection(
Argument::createIntListTypeArgument('id'),
- new Argument(
+ Argument::createIntListTypeArgument('exclude'),
+ new Argument(
'order',
new TypeCollection(
new Type\EnumListType(array('id', 'id_reverse', 'alpha', 'alpha_reverse'))
@@ -77,7 +76,7 @@ class TaxRule extends BaseI18nLoop
$search = TaxRuleQuery::create();
/* manage translations */
- $locale = $this->configureI18nProcessing($search, 'TITLE', 'DESCRIPTION');
+ $locale = $this->configureI18nProcessing($search, array('TITLE', 'DESCRIPTION'));
$id = $this->getId();
diff --git a/core/lib/Thelia/Tests/Core/Template/Element/BaseLoopTestor.php b/core/lib/Thelia/Tests/Core/Template/Element/BaseLoopTestor.php
index 2b31d265a..eb271d4c1 100755
--- a/core/lib/Thelia/Tests/Core/Template/Element/BaseLoopTestor.php
+++ b/core/lib/Thelia/Tests/Core/Template/Element/BaseLoopTestor.php
@@ -132,7 +132,7 @@ abstract class BaseLoopTestor extends \PHPUnit_Framework_TestCase
$this->assertInstanceOf('\Thelia\Core\Template\Element\LoopResult', $methodReturn);
}
- public function baseTestSearchById($id)
+ public function baseTestSearchById($id, $other_args = array())
{
$this->instance->initializeArgs(array_merge(
$this->getMandatoryArguments(),
@@ -140,7 +140,8 @@ abstract class BaseLoopTestor extends \PHPUnit_Framework_TestCase
"type" => "foo",
"name" => "foo",
"id" => $id,
- )
+ ),
+ $other_args
));
$dummy = null;
diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/DocumentTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/DocumentTest.php
index 04e41b6f8..2b7019879 100644
--- a/core/lib/Thelia/Tests/Core/Template/Loop/DocumentTest.php
+++ b/core/lib/Thelia/Tests/Core/Template/Loop/DocumentTest.php
@@ -58,32 +58,27 @@ class DocumentTest extends BaseLoopTestor
{
$document = ProductDocumentQuery::create()->findOne();
- $this->baseTestSearchById($document->getId());
+ $this->baseTestSearchById($document->getId(), array('source' => 'product'));
}
public function testSearchByFolderId()
{
$document = FolderDocumentQuery::create()->findOne();
- $this->baseTestSearchById($document->getId());
+ $this->baseTestSearchById($document->getId(), array('source' => 'folder'));
}
public function testSearchByContentId()
{
$document = ContentDocumentQuery::create()->findOne();
- $this->baseTestSearchById($document->getId());
+ $this->baseTestSearchById($document->getId(), array('source' => 'content'));
}
public function testSearchByCategoryId()
{
$document = CategoryDocumentQuery::create()->findOne();
- $this->baseTestSearchById($document->getId());
- }
-
- public function testSearchLimit()
- {
- $this->baseTestSearchWithLimit(1);
+ $this->baseTestSearchById($document->getId(), array('source' => 'category'));
}
}
diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/ImageTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/ImageTest.php
index 3d2517c0a..ba4bfadc5 100644
--- a/core/lib/Thelia/Tests/Core/Template/Loop/ImageTest.php
+++ b/core/lib/Thelia/Tests/Core/Template/Loop/ImageTest.php
@@ -58,32 +58,27 @@ class ImageTest extends BaseLoopTestor
{
$image = ProductImageQuery::create()->findOne();
- $this->baseTestSearchById($image->getId());
+ $this->baseTestSearchById($image->getId(), array('source' => 'product'));
}
public function testSearchByFolderId()
{
$image = FolderImageQuery::create()->findOne();
- $this->baseTestSearchById($image->getId());
+ $this->baseTestSearchById($image->getId(), array('source' => 'folder'));
}
public function testSearchByContentId()
{
$image = ContentImageQuery::create()->findOne();
- $this->baseTestSearchById($image->getId());
+ $this->baseTestSearchById($image->getId(), array('source' => 'content'));
}
public function testSearchByCategoryId()
{
$image = CategoryImageQuery::create()->findOne();
- $this->baseTestSearchById($image->getId());
- }
-
- public function testSearchLimit()
- {
- $this->baseTestSearchWithLimit(1);
+ $this->baseTestSearchById($image->getId(), array('source' => 'category'));
}
}
diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/ProductTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/ProductTest.php
index 1b307c5b5..07e179cbd 100755
--- a/core/lib/Thelia/Tests/Core/Template/Loop/ProductTest.php
+++ b/core/lib/Thelia/Tests/Core/Template/Loop/ProductTest.php
@@ -27,6 +27,7 @@ use Thelia\Model\ProductQuery;
use Thelia\Tests\Core\Template\Element\BaseLoopTestor;
use Thelia\Core\Template\Loop\Product;
+use Propel\Runtime\ActiveQuery\Criteria;
/**
*
@@ -52,7 +53,7 @@ class ProductTest extends BaseLoopTestor
public function testSearchById()
{
- $product = ProductQuery::create()->findOne();
+ $product = ProductQuery::create()->orderById(Criteria::ASC)->findOne();
$this->baseTestSearchById($product->getId());
}
diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/TaxRuleTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/TaxRuleTest.php
new file mode 100644
index 000000000..20523bfa5
--- /dev/null
+++ b/core/lib/Thelia/Tests/Core/Template/Loop/TaxRuleTest.php
@@ -0,0 +1,60 @@
+. */
+/* */
+/*************************************************************************************/
+
+namespace Thelia\Tests\Core\Template\Loop;
+
+use Thelia\Tests\Core\Template\Element\BaseLoopTestor;
+
+use Thelia\Core\Template\Loop\TaxRule;
+use Thelia\Model\TaxRuleQuery;
+
+/**
+ *
+ * @author Etienne Roudeix
+ *
+ */
+class TaxRuleTest extends BaseLoopTestor
+{
+ public function getTestedClassName()
+ {
+ return 'Thelia\Core\Template\Loop\TaxRule';
+ }
+
+ public function getTestedInstance()
+ {
+ return new TaxRule($this->container);
+ }
+
+ public function getMandatoryArguments()
+ {
+ return array();
+ }
+
+ public function testSearchById()
+ {
+ $tr = TaxRuleQuery::create()->findOne();
+
+ $this->baseTestSearchById($tr->getId());
+ }
+
+}
diff --git a/core/lib/Thelia/Tests/TaxEngine/CalculatorTest.php b/core/lib/Thelia/Tests/TaxEngine/CalculatorTest.php
index e0443c5ba..502b14c7e 100755
--- a/core/lib/Thelia/Tests/TaxEngine/CalculatorTest.php
+++ b/core/lib/Thelia/Tests/TaxEngine/CalculatorTest.php
@@ -78,7 +78,7 @@ class CalculatorTest extends \PHPUnit_Framework_TestCase
public function testLoad()
{
- $productQuery = ProductQuery::create()->findOneById(1);
+ $productQuery = ProductQuery::create()->findOne();
$countryQuery = CountryQuery::create()->findOneById(64);
$calculator = new Calculator();