Skip to content

Commit

Permalink
Added test to show how to use isEmpty() on a query
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed May 4, 2015
1 parent bac36e0 commit 8737106
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/TestCase/ORM/QueryTest.php
Expand Up @@ -2630,4 +2630,16 @@ public function testNotSoFarMatchingWithContainOnTheSameAssociation()
$this->assertCount(2, $result->tags);
$this->assertEquals(2, $result->_matchingData['tags']->id);
}

/**
* Tests that isEmpty() can be called on a query
*
* @return void
*/
public function testIsEmpty()
{
$table = TableRegistry::get('articles');
$this->assertFalse($table->find()->isEmpty());
$this->assertTrue($table->find()->where(['id' => -1])->isEmpty());
}
}

0 comments on commit 8737106

Please sign in to comment.