add Unit Test for isEmpty change in LazyCriteriaCollection
This commit is contained in:
parent
3e26330c53
commit
03523c67d5
@ -103,4 +103,28 @@ class LazyCriteriaCollectionTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$this->assertEquals(array($foo), $this->lazyCriteriaCollection->matching($criteria)->toArray());
|
||||
}
|
||||
|
||||
public function testIsEmptyUsesCountWhenNotInitialized()
|
||||
{
|
||||
$this->persister->expects($this->once())->method('count')->with($this->criteria)->will($this->returnValue(0));
|
||||
|
||||
$this->assertTrue($this->lazyCriteriaCollection->isEmpty());
|
||||
}
|
||||
|
||||
public function testIsEmptyUsesWrappedCollectionWhenInitialized()
|
||||
{
|
||||
$this
|
||||
->persister
|
||||
->expects($this->once())
|
||||
->method('loadCriteria')
|
||||
->with($this->criteria)
|
||||
->will($this->returnValue(array('foo', 'bar', 'baz')));
|
||||
|
||||
// should never call the persister's count
|
||||
$this->persister->expects($this->never())->method('count');
|
||||
|
||||
$this->assertSame(array('foo', 'bar', 'baz'), $this->lazyCriteriaCollection->toArray());
|
||||
|
||||
$this->assertFalse($this->lazyCriteriaCollection->isEmpty());
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user