From e58f9fcc591b13ca27de1605216107e17777f746 Mon Sep 17 00:00:00 2001 From: Jon Goldberg <jon@megaphonetech.com> Date: Tue, 13 Oct 2020 19:10:25 -0400 Subject: [PATCH] Test for event#43 --- .../Contact/Page/View/UserDashBoardTest.php | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/phpunit/CRM/Contact/Page/View/UserDashBoardTest.php b/tests/phpunit/CRM/Contact/Page/View/UserDashBoardTest.php index 54a4f572db9f..71d5481acb17 100644 --- a/tests/phpunit/CRM/Contact/Page/View/UserDashBoardTest.php +++ b/tests/phpunit/CRM/Contact/Page/View/UserDashBoardTest.php @@ -167,4 +167,29 @@ protected function runUserDashboard() { $_REQUEST = []; } + /** + * Tests the event dashboard as a minimally permissioned user. + */ + public function testEventDashboard() { + CRM_Core_Config::singleton()->userPermissionClass->permissions = [ + '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; + $this->participantCreate($params); + $params['event_id'] = $event2id; + $this->participantCreate($params); + $this->runUserDashboard(); + $expectedStrings = [ + '<div class="header-dark">Your Event(s)</div>', + '<td class="crm-participant-event-id_1"><a href="/index.php?q=civicrm/event/info&reset=1&id=1&context=dashboard">Annual CiviCRM meet</a></td>', + '<td class="crm-participant-event-id_2"><a href="/index.php?q=civicrm/event/info&reset=1&id=2&context=dashboard">Social Distancing Meetup Group</a></td>', + ]; + $this->assertPageContains($expectedStrings); + $this->individualCreate(); + } + }