Skip to content

Commit

Permalink
Merge pull request #11515 from seamuslee001/CRM-20972-46
Browse files Browse the repository at this point in the history
CRM-20972 Handle new type of exception in PHP7.1 when too few argumen…
  • Loading branch information
jackrabbithanna authored Feb 11, 2018
2 parents ad0b7f4 + 4a6076c commit 9cbb4ee
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions tests/phpunit/api/v3/SyntaxConformanceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -641,12 +641,21 @@ public function testNotImplemented_get($Entity) {

/**
* @dataProvider entities
* @expectedException PHPUnit_Framework_Error
* @param $Entity
*/
public function testWithoutParam_get($Entity) {
// should get php complaining that a param is missing
$result = civicrm_api($Entity, 'Get');
try {
$result = civicrm_api($Entity, 'Get');
$this->fail('Expected an exception. No exception was thrown.');
}
// As of php7.1 a new Exception is thrown by PHP ArgumentCountError when not enough params are passed.
catch (ArgumentCountError $e) {
/* ok */
}
catch (PHPUnit_Framework_Error $e) {
/* ok */
}
}

/**
Expand Down Expand Up @@ -1316,12 +1325,21 @@ public function testNotImplemented_delete($Entity) {

/**
* @dataProvider entities
* @expectedException PHPUnit_Framework_Error
* @param $Entity
*/
public function testWithoutParam_delete($Entity) {
// should delete php complaining that a param is missing
$result = civicrm_api($Entity, 'Delete');
// should get php complaining that a param is missing
try {
$result = civicrm_api($Entity, 'Delete');
$this->fail('Expected an exception. No exception was thrown.');
}
// As of php7.1 a new Exception is thrown by PHP ArgumentCountError when not enough params are passed.
catch (ArgumentCountError $e) {
/* ok */
}
catch (PHPUnit_Framework_Error $e) {
/* ok */
}
}

/**
Expand Down

0 comments on commit 9cbb4ee

Please sign in to comment.