Merge pull request #24117 from civicrm/5.52
[civicrm-core.git] / tests / phpunit / CRM / Contact / Page / View / UserDashBoardTest.php
index 7ba28448b5c9e647a45e221a785a928f0e4397ae..91e467eac767f89befe7e5b84fc1608dc784f08d 100644 (file)
@@ -137,10 +137,9 @@ class CRM_Contact_Page_View_UserDashBoardTest extends CiviUnitTestCase {
   /**
    * Test the content of the dashboard.
    *
-   * @throws \CRM_Core_Exception
    * @throws \CiviCRM_API3_Exception
    */
-  public function testDashboardContentContributions() {
+  public function testDashboardContentContributions(): void {
     $this->contributionCreate(['contact_id' => $this->contactID]);
     $this->contributions[] = civicrm_api3('Contribution', 'get', [
       'contact_id' => $this->contactID,
@@ -151,7 +150,7 @@ class CRM_Contact_Page_View_UserDashBoardTest extends CiviUnitTestCase {
     $expectedStrings = [
       'Your Contribution(s)',
       '<table class="selector"><tr class="columnheader"><th>Total Amount</th><th>Financial Type</th><th>Received date</th><th>Receipt Sent</th><th>Balance</th><th>Status</th>',
-      '<td>$ 100.00 </td><td>Donation</td>',
+      '<td>$100.00 </td><td>Donation</td>',
       '<td>Completed</td>',
     ];
     $this->assertPageContains($expectedStrings);
@@ -163,16 +162,16 @@ class CRM_Contact_Page_View_UserDashBoardTest extends CiviUnitTestCase {
    * @throws \CRM_Core_Exception
    * @throws \CiviCRM_API3_Exception
    */
-  public function testDashboardPartialPayments() {
+  public function testDashboardPartialPayments(): void {
     $contributionId = $this->contributionCreate([
       'contact_id' => $this->contactID,
       'contribution_status_id' => 'Pending',
       'total_amount' => 25,
     ]);
-    $result = civicrm_api3('Payment', 'create', [
+    $this->callAPISuccess('Payment', 'create', [
       'contribution_id' => $contributionId,
       'total_amount' => 11,
-      'trxn_date' => "2021-05-11",
+      'trxn_date' => '2021-05-11',
     ]);
     $this->contributions[] = civicrm_api3('Contribution', 'get', [
       'contact_id' => $this->contactID,
@@ -183,8 +182,8 @@ class CRM_Contact_Page_View_UserDashBoardTest extends CiviUnitTestCase {
     $expectedStrings = [
       'Your Contribution(s)',
       '<table class="selector"><tr class="columnheader"><th>Total Amount</th><th>Financial Type</th><th>Received date</th><th>Receipt Sent</th><th>Balance</th><th>Status</th>',
-      '<td>$ 25.00 </td><td>Donation</td>',
-      '<td>$ 14.00</td><td>Partially paid</td>',
+      '<td>$25.00 </td><td>Donation</td>',
+      '<td>$14.00</td><td>Partially paid</td>',
       'Pay Now',
     ];
     $this->assertPageContains($expectedStrings);
@@ -206,7 +205,7 @@ class CRM_Contact_Page_View_UserDashBoardTest extends CiviUnitTestCase {
   /**
    * Tests the event dashboard as a minimally permissioned user.
    */
-  public function testEventDashboard() {
+  public function testEventDashboard(): void {
     CRM_Core_Config::singleton()->userPermissionClass->permissions = [
       'register for events',
       'access Contact Dashboard',