Skip to content

Commit

Permalink
Fix Pomm\Object\Collection::rewind()
Browse files Browse the repository at this point in the history
Set the right property
  • Loading branch information
sanpii committed Mar 31, 2014
1 parent 24f9a18 commit ced8b21
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Pomm/Object/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public function count()
*/
public function rewind()
{
$this->index = 0;
$this->position = 0;
}

/**
Expand Down
6 changes: 4 additions & 2 deletions tests/Pomm/Test/Object/CollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,11 @@ public function testRewind(Collection $collection)
$val1[] = $entity;
}

$this->assertCount(10, $collection);

foreach($collection as $index => $entity)
{
$this->assertTrue($val1[$key] !== $entity, "Iterating twice on a Collection returns the same results");
$this->assertTrue($val1[$index] !== $entity, "Iterating twice on a Collection returns the same results");
}
}

Expand All @@ -116,7 +118,7 @@ public function testFilters(Collection $collection)

foreach ($collection as $index => $entity)
{
$this->assertTrue($entity['id'] = ($index + 1) * 2, "Check filter");
$this->assertTrue($entity['id'] == ($index + 1) * 2, "Check filter");
}
}
}
Expand Down

0 comments on commit ced8b21

Please sign in to comment.