Merge pull request #18761 from MegaphoneJon/event43-test
authorSeamus Lee <seamuslee001@gmail.com>
Wed, 14 Oct 2020 19:56:25 +0000 (06:56 +1100)
committerGitHub <noreply@github.com>
Wed, 14 Oct 2020 19:56:25 +0000 (06:56 +1100)
Test for event#43

tests/phpunit/CRM/Contact/Page/View/UserDashBoardTest.php

index 54a4f572db9fd442cea5c54cfe3f96453fcdfb3f..71d5481acb17b205de605406c4f2a6c02128c75f 100644 (file)
@@ -167,4 +167,29 @@ class CRM_Contact_Page_View_UserDashBoardTest extends CiviUnitTestCase {
     $_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();
+  }
+
 }