1
0
mirror of synced 2025-03-22 16:03:49 +03:00

Verifying that count on the lazy criteria collection is cached

This commit is contained in:
Marco Pivetta 2014-05-17 18:51:01 +02:00
parent 81fbb049a5
commit c46b63f6b4

View File

@ -34,8 +34,17 @@ class LazyCriteriaCollectionTest extends PHPUnit_Framework_TestCase
*/
protected function setUp()
{
$this->persister = $this->getMock('Doctrine\ORM\Persisters\EntityPersister');
$this->criteria = new Criteria();
$this->$lazyCriteriaCollection = new LazyCriteriaCollection($this->persister, $this->criteria);
$this->persister = $this->getMock('Doctrine\ORM\Persisters\EntityPersister');
$this->criteria = new Criteria();
$this->lazyCriteriaCollection = new LazyCriteriaCollection($this->persister, $this->criteria);
}
public function testCountIsCached()
{
$this->persister->expects($this->once())->method('count')->with($this->criteria)->will($this->returnValue(10));
$this->assertSame(10, $this->lazyCriteriaCollection->count());
$this->assertSame(10, $this->lazyCriteriaCollection->count());
$this->assertSame(10, $this->lazyCriteriaCollection->count());
}
}