diff --git a/tests/Doctrine/Tests/ORM/LazyCriteriaCollectionTest.php b/tests/Doctrine/Tests/ORM/LazyCriteriaCollectionTest.php index 93cdc01d5..2d5209cf4 100644 --- a/tests/Doctrine/Tests/ORM/LazyCriteriaCollectionTest.php +++ b/tests/Doctrine/Tests/ORM/LazyCriteriaCollectionTest.php @@ -47,4 +47,13 @@ class LazyCriteriaCollectionTest extends PHPUnit_Framework_TestCase $this->assertSame(10, $this->lazyCriteriaCollection->count()); $this->assertSame(10, $this->lazyCriteriaCollection->count()); } + + public function testCountIsCachedEvenWithZeroResult() + { + $this->persister->expects($this->once())->method('count')->with($this->criteria)->will($this->returnValue(0)); + + $this->assertSame(0, $this->lazyCriteriaCollection->count()); + $this->assertSame(0, $this->lazyCriteriaCollection->count()); + $this->assertSame(0, $this->lazyCriteriaCollection->count()); + } }