From 60beca376067caa7aa9e59db2d5946c5f78535a1 Mon Sep 17 00:00:00 2001 From: Oliver Tischlinger Date: Fri, 25 Sep 2015 10:44:30 +0200 Subject: [PATCH] changes after code review --- lib/Doctrine/ORM/LazyCriteriaCollection.php | 2 +- tests/Doctrine/Tests/ORM/LazyCriteriaCollectionTest.php | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) 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