Use eventCreateUnpaid in participantCreate
authorEileen McNaughton <emcnaughton@wikimedia.org>
Mon, 3 Jul 2023 04:11:35 +0000 (16:11 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Mon, 3 Jul 2023 04:55:35 +0000 (16:55 +1200)
tests/phpunit/CRM/Event/ActionMappingTest.php
tests/phpunit/CiviTest/CiviUnitTestCase.php

index eef9cc819da6a8733ac9859f0cac1079a7133f1e..940e8e0c11ed95f787f33a3c0320c7723520d25a 100644 (file)
@@ -9,6 +9,8 @@
  +--------------------------------------------------------------------+
  */
 
+use Civi\ActionSchedule\AbstractMappingTest;
+
 /**
  * Class CRM_Event_ActionMappingTest
  * @group ActionSchedule
  * @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->getEventID();
     $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', []);
   }
 
 }
index 3202d555245ef80c717637b963ec74eaeedec442..2c7765f28f19117163b15de8780b88ae0d4c190c 100644 (file)
@@ -784,7 +784,7 @@ class CiviUnitTestCase extends PHPUnit\Framework\TestCase {
       $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 = [