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

TestBase: Fix method getRemoteEvents #93

Open
wants to merge 1 commit into
base: run-tests-in-github-action
Choose a base branch
from
Open
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
6 changes: 5 additions & 1 deletion api/v3/RemoteEvent/Get.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ function civicrm_api3_remote_event_get($params)
// Translate event ID.
$original_params = $get_params->getOriginalParameters();
if (!empty($original_params['id'])) {
$get_params->setParameter('event_id', $original_params['id']);
if (!is_numeric($original_params['id'])) {
throw new \InvalidArgumentException('Only a single ID is allowed');
}

$get_params->setParameter('event_id', (int) $original_params['id']);
}

// dispatch search parameters event
Expand Down
12 changes: 5 additions & 7 deletions tests/phpunit/CRM/Remoteevent/TestBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -403,16 +403,14 @@ public function setSpeakerRoles($value)
/**
* Use the RemoteEvent.get API to event information
*
* @param array $event_ids
* @phpstan-param list<int> $event_ids
* list of event_ids
*
* @phpstan-return list<array<string, mixed>>
*/
public function getRemoteEvents($event_ids)
public function getRemoteEvents(array $event_ids): array
{
$result = $this->traitCallAPISuccess('RemoteEvent', 'get', [
'id' => ['IN' => $event_ids],
'sequential' => 0
]);
return $result['values'];
return array_map([$this, 'getRemoteEvent'], $event_ids);
}

/**
Expand Down
Loading