From a5c91e2cbea1f810ce11ff335cb8d866a72e2b49 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Sat, 3 Jun 2023 10:07:03 +1200 Subject: [PATCH] Switch some unpaid event test setup to use createUnPaidEvent This resolves some of the ambiguity Spin off from https://github.com/civicrm/civicrm-core/pull/26348 --- tests/phpunit/CRM/Contact/Page/View/UserDashBoardTest.php | 7 +++---- tests/phpunit/CRM/Event/BAO/EventPermissionsTest.php | 4 ++-- tests/phpunit/api/v3/JobTest.php | 6 ++++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/tests/phpunit/CRM/Contact/Page/View/UserDashBoardTest.php b/tests/phpunit/CRM/Contact/Page/View/UserDashBoardTest.php index c3d0d14915..50c61aae8c 100644 --- a/tests/phpunit/CRM/Contact/Page/View/UserDashBoardTest.php +++ b/tests/phpunit/CRM/Contact/Page/View/UserDashBoardTest.php @@ -268,12 +268,11 @@ class CRM_Contact_Page_View_UserDashBoardTest extends CiviUnitTestCase { 'register for events', 'access Contact Dashboard', ]; - $event1id = $this->eventCreate()['id']; - $event2id = $this->eventCreate(['title' => 'Social Distancing Meetup Group'])['id']; + $params['contact_id'] = $this->contactID; - $params['event_id'] = $event1id; + $params['event_id'] = $this->eventCreateUnpaid()['id'];; $this->participantCreate($params); - $params['event_id'] = $event2id; + $params['event_id'] = $this->eventCreateUnpaid(['title' => 'Social Distancing Meetup Group'], 'event_2')['id']; $this->participantCreate($params); $this->runUserDashboard(); $expectedStrings = [ diff --git a/tests/phpunit/CRM/Event/BAO/EventPermissionsTest.php b/tests/phpunit/CRM/Event/BAO/EventPermissionsTest.php index eaebc2c62e..82a4881dbe 100644 --- a/tests/phpunit/CRM/Event/BAO/EventPermissionsTest.php +++ b/tests/phpunit/CRM/Event/BAO/EventPermissionsTest.php @@ -45,7 +45,7 @@ class CRM_Event_BAO_EventPermissionsTest extends CiviUnitTestCase { } public function createOwnEvent() { - $event = $this->eventCreate([ + $event = $this->eventCreateUnpaid([ 'created_id' => $this->contactID, ]); $this->ownEventID = $event['id']; @@ -53,7 +53,7 @@ class CRM_Event_BAO_EventPermissionsTest extends CiviUnitTestCase { public function createOtherEvent() { $this->otherContactID = $this->contactID + 1; - $event = $this->eventCreate([ + $event = $this->eventCreateUnpaid([ 'created_id' => $this->otherContactID, ]); $this->otherEventID = $event['id']; diff --git a/tests/phpunit/api/v3/JobTest.php b/tests/phpunit/api/v3/JobTest.php index f3a033f399..dd55035dee 100644 --- a/tests/phpunit/api/v3/JobTest.php +++ b/tests/phpunit/api/v3/JobTest.php @@ -306,6 +306,8 @@ class api_v3_JobTest extends CiviUnitTestCase { /** * Event templates should not send reminders to additional contacts. + * + * @throws \CRM_Core_Exception */ public function testTemplateRemindAdditionalContacts(): void { $contactId = $this->individualCreate(); @@ -314,7 +316,7 @@ class api_v3_JobTest extends CiviUnitTestCase { 'contact_id' => $contactId, 'group_id' => $groupId, ]); - $event = $this->eventCreate(['is_template' => 1, 'template_title' => "I'm a template", 'title' => NULL]); + $event = $this->eventCreateUnpaid(['is_template' => 1, 'template_title' => "I'm a template", 'title' => NULL]); $eventId = $event['id']; $this->callAPISuccess('action_schedule', 'create', [ @@ -346,7 +348,7 @@ class api_v3_JobTest extends CiviUnitTestCase { 'contact_id' => $contactId, 'group_id' => $groupId, ]); - $event = $this->eventCreate(['title' => 'delete this event']); + $event = $this->eventCreateUnpaid(['title' => 'delete this event']); $eventId = $event['id']; $this->callAPISuccess('action_schedule', 'create', [ -- 2.25.1