Skip to content

Commit

Permalink
Fix APIv4 test to assert an exception is thrown
Browse files Browse the repository at this point in the history
The test had only run its assertion in the catch block which would have been skipped if an exception wasn't thrown
  • Loading branch information
colemanw committed Nov 21, 2020
1 parent b316694 commit d34aa01
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 d34aa01

Please sign in to comment.