Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM-20972 Handle new type of exception in PHP7.1 when too few argumen… #11515

Merged
merged 1 commit into from
Feb 11, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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