test product loop limit

This commit is contained in:
Etienne Roudeix
2013-09-12 11:28:32 +02:00
parent e81b894816
commit f75b6e876c
2 changed files with 25 additions and 6 deletions

View File

@@ -129,6 +129,7 @@ abstract class BaseLoop
$loopType = isset($nameValuePairs['type']) ? $nameValuePairs['type'] : "undefined";
$loopName = isset($nameValuePairs['name']) ? $nameValuePairs['name'] : "undefined";
$this->args->rewind();
while (($argument = $this->args->current()) !== false) {
$this->args->next();

View File

@@ -54,13 +54,17 @@ class ProductTest extends BaseLoopTestor
{
$product = ProductQuery::create()->findOne();
$loop = new Product($this->container);
$loop->initializeArgs(array(
"type" => "product",
"name" => "product",
"id" => $product->getId(),
$this->instance->initializeArgs(array_merge(
$this->getMandatoryArguments(),
array(
"type" => "product",
"name" => "product",
"id" => $product->getId(),
)
));
$loopResults = $loop->exec($pagination);
$dummy = null;
$loopResults = $this->instance->exec($dummy);
$this->assertEquals(1, $loopResults->getCount());
@@ -68,4 +72,18 @@ class ProductTest extends BaseLoopTestor
$this->assertEquals($product->getId(), $substitutions['ID']);
}
public function testSearchLimit()
{
$this->instance->initializeArgs(array(
"type" => "product",
"name" => "product",
"limit" => 3,
));
$dummy = null;
$loopResults = $this->instance->exec($dummy);
$this->assertEquals(3, $loopResults->getCount());
}
}