From 84dafa59329285bc38424d61d2e726c432729eb6 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Mon, 3 Jul 2023 16:11:35 +1200 Subject: [PATCH] Use eventCreateUnpaid in participantCreate --- tests/phpunit/CRM/Event/ActionMappingTest.php | 14 +++++++------- tests/phpunit/CiviTest/CiviUnitTestCase.php | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/phpunit/CRM/Event/ActionMappingTest.php b/tests/phpunit/CRM/Event/ActionMappingTest.php index eef9cc819da6..83ee12269d45 100644 --- a/tests/phpunit/CRM/Event/ActionMappingTest.php +++ b/tests/phpunit/CRM/Event/ActionMappingTest.php @@ -9,6 +9,8 @@ +--------------------------------------------------------------------+ */ +use Civi\ActionSchedule\AbstractMappingTest; + /** * Class CRM_Event_ActionMappingTest * @group ActionSchedule @@ -19,24 +21,22 @@ * @see \Civi\ActionSchedule\AbstractMappingTest * @group headless */ -class CRM_Event_ActionMappingTest extends \Civi\ActionSchedule\AbstractMappingTest { +class CRM_Event_ActionMappingTest extends AbstractMappingTest { public function createTestCases() { } - public function testLimitByRoleId() { - $participantId = $this->participantCreate(['role_id' => [1, 2]]); - $participant = $this->callAPISuccess('participant', 'getsingle', ['id' => $participantId]); - $eventId = $participant['event_id']; + public function testLimitByRoleID(): void { + $this->participantCreate(['role_id' => [1, 2], 'event_id' => $this->eventCreateUnpaid()['id']]); $this->schedule->mapping_id = CRM_Event_ActionMapping::EVENT_NAME_MAPPING_ID; $this->schedule->start_action_date = 'start_date'; - $this->schedule->entity_value = $eventId; + $this->schedule->entity_value = $this->ids['Event']['PaidEvent']; $this->schedule->limit_to = 1; $this->schedule->recipient_listing = 1; $this->startWeekBefore(); $this->useHelloFirstName(); $this->schedule->save(); - $this->callAPISuccess('job', 'send_reminder', []); + $this->callAPISuccess('Job', 'send_reminder', []); } } diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php index 3202d555245e..2c7765f28f19 100644 --- a/tests/phpunit/CiviTest/CiviUnitTestCase.php +++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php @@ -784,7 +784,7 @@ public function participantCreate(array $params = []): int { $this->ids['Contact']['participant'] = $params['contact_id'] = $this->individualCreate(); } if (empty($params['event_id'])) { - $event = $this->eventCreate(['end_date' => 20081023, 'registration_end_date' => 20081015]); + $event = $this->eventCreateUnpaid(['end_date' => 20081023, 'registration_end_date' => 20081015]); $params['event_id'] = $event['id']; } $defaults = [