Skip to content

Commit

Permalink
Merge pull request #19009 from colemanw/limitTest
Browse files Browse the repository at this point in the history
Fix APIv4 test to assert an exception is thrown
  • Loading branch information
seamuslee001 authored Nov 21, 2020
2 parents 23840ec + d34aa01 commit 8257f28
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/phpunit/api/v4/Action/ContactGetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,14 @@ public function testGetWithLimit() {
$limit2 = Contact::get(FALSE)->setLimit(2)->addSelect('sort_name', 'row_count')->execute();
$this->assertCount(2, (array) $limit2);
$this->assertCount($num, $limit2);
$msg = '';
try {
$limit2->single();
}
catch (\API_Exception $e) {
$this->assertRegExp(';Expected to find one Contact record;', $e->getMessage());
$msg = $e->getMessage();
}
$this->assertRegExp(';Expected to find one Contact record;', $msg);
$limit1 = Contact::get(FALSE)->setLimit(1)->execute();
$this->assertCount(1, (array) $limit1);
$this->assertCount(1, $limit1);
Expand Down

0 comments on commit 8257f28

Please sign in to comment.