diff --git a/lib/Doctrine/ORM/LazyCriteriaCollection.php b/lib/Doctrine/ORM/LazyCriteriaCollection.php index 876341c72..0751bee41 100644 --- a/lib/Doctrine/ORM/LazyCriteriaCollection.php +++ b/lib/Doctrine/ORM/LazyCriteriaCollection.php @@ -93,7 +93,7 @@ class LazyCriteriaCollection extends AbstractLazyCollection implements Selectabl return $this->collection->isEmpty(); } - return $this->count() == 0; + return !$this->count(); } /** diff --git a/tests/Doctrine/Tests/ORM/LazyCriteriaCollectionTest.php b/tests/Doctrine/Tests/ORM/LazyCriteriaCollectionTest.php index 42965f268..92da34cda 100644 --- a/tests/Doctrine/Tests/ORM/LazyCriteriaCollectionTest.php +++ b/tests/Doctrine/Tests/ORM/LazyCriteriaCollectionTest.php @@ -111,6 +111,13 @@ class LazyCriteriaCollectionTest extends PHPUnit_Framework_TestCase $this->assertTrue($this->lazyCriteriaCollection->isEmpty()); } + public function testIsEmptyIsFalseIfCountIsNotZero() + { + $this->persister->expects($this->once())->method('count')->with($this->criteria)->will($this->returnValue(1)); + + $this->assertFalse($this->lazyCriteriaCollection->isEmpty()); + } + public function testIsEmptyUsesWrappedCollectionWhenInitialized() { $this