Skip to content

Commit

Permalink
Merge pull request #18761 from MegaphoneJon/event43-test
Browse files Browse the repository at this point in the history
Test for event#43
  • Loading branch information
seamuslee001 authored Oct 14, 2020
2 parents 7ad12b2 + e58f9fc commit 1020006
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/phpunit/CRM/Contact/Page/View/UserDashBoardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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&amp;reset=1&amp;id=1&amp;context=dashboard">Annual CiviCRM meet</a></td>',
'<td class="crm-participant-event-id_2"><a href="/index.php?q=civicrm/event/info&amp;reset=1&amp;id=2&amp;context=dashboard">Social Distancing Meetup Group</a></td>',
];
$this->assertPageContains($expectedStrings);
$this->individualCreate();
}

}

0 comments on commit 1020006

Please sign in to comment.