Fix the ContributionPageTest to set up valid memberships
authorEileen McNaughton <emcnaughton@wikimedia.org>
Mon, 7 Jun 2021 02:20:50 +0000 (14:20 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Mon, 7 Jun 2021 02:21:05 +0000 (14:21 +1200)
Fix for https://github.com/civicrm/civicrm-core/pull/20495
- resolve invalid test config

tests/phpunit/api/v3/ContributionPageTest.php

index 52aa8fd34b6da05231cf27fa11afdb38a81eee67..523b42913a8f2a1fc98a2b3e906018a49d0f8f55 100644 (file)
@@ -852,24 +852,11 @@ class api_v3_ContributionPageTest extends CiviUnitTestCase {
       $expectedMembershipStatus = 5;
     }
 
-    $submitParams = [
-      'price_' . $this->_ids['price_field'][0] => reset($this->_ids['price_field_value']),
-      'id' => (int) $this->_ids['contribution_page'],
-      'amount' => 10,
-      'billing_first_name' => 'Billy',
-      'billing_middle_name' => 'Goat',
-      'billing_last_name' => 'Gruff',
-      'email' => 'billy@goat.gruff',
-      'selectMembership' => $this->ids['MembershipType'],
-      'payment_processor_id' => 1,
-      'credit_card_number' => '4111111111111111',
-      'credit_card_type' => 'Visa',
-      'credit_card_exp_date' => ['M' => 9, 'Y' => 2040],
-      'cvv2' => 123,
+    $submitParams = array_merge($this->getSubmitParamsMembership(TRUE), [
       'is_recur' => 1,
       'frequency_interval' => 1,
       'frequency_unit' => $this->params['recur_frequency_unit'],
-    ];
+    ]);
 
     $this->callAPIAndDocument('ContributionPage', 'submit', $submitParams, __FUNCTION__, __FILE__, 'submit contribution page');
     $contribution = $this->callAPISuccess('contribution', 'getsingle', [