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

[NFC] [TEST] cleanup, more use of return in ActivityTest #20633

Merged
merged 1 commit into from
Jun 18, 2021
Merged
Show file tree
Hide file tree
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
7 changes: 2 additions & 5 deletions Civi/Test/Api3TestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,7 @@ public function callAPISuccessGetSingle($entity, $params, $checkAgainst = NULL)
}

/**
* This function exists to wrap api getValue function & check the result
* so we can ensure they succeed & throw exceptions without litterering the test with checks
* There is a type check in this
* This function wraps the getValue api and checks the result.
*
* @param string $entity
* @param array $params
Expand All @@ -261,15 +259,14 @@ public function callAPISuccessGetSingle($entity, $params, $checkAgainst = NULL)
* - object
*
* @return array|int
* @throws \CRM_Core_Exception
*/
public function callAPISuccessGetValue($entity, $params, $type = NULL) {
$params += [
'version' => $this->_apiversion,
];
$result = $this->civicrm_api($entity, 'getvalue', $params);
if (is_array($result) && (!empty($result['is_error']) || isset($result['values']))) {
throw new \CRM_Core_Exception('Invalid getvalue result' . print_r($result, TRUE));
$this->fail('Invalid getvalue result' . print_r($result, TRUE));
}
if ($type) {
if ($type === 'integer') {
Expand Down
Loading