Fix test to use form flow / helper
authorEileen McNaughton <emcnaughton@wikimedia.org>
Thu, 14 Apr 2022 23:18:01 +0000 (11:18 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Thu, 14 Apr 2022 23:18:01 +0000 (11:18 +1200)
tests/phpunit/CRM/Event/Form/Registration/ConfirmTest.php

index 9503d80789c19629a724a73b3a2954c0eec624b9..33ba6ccedf30f256ab19862cfea0c37a914ef675 100644 (file)
@@ -567,68 +567,57 @@ class CRM_Event_Form_Registration_ConfirmTest extends CiviUnitTestCase {
   }
 
   /**
-   * event#64 - ensure we send to the submitted email, not the primary email when they differ.
+   * Ensure we send to the submitted email, not the primary email, if different.
    *
-   * @throws \Exception
+   * event#64.
    */
   public function testSubmitNonPrimaryEmail(): void {
     $event = $this->eventCreate();
     $mut = new CiviMailUtils($this, TRUE);
-    $cid = $this->createLoggedInUser();
-    CRM_Event_Form_Registration_Confirm::testSubmit([
-      'id' => $event['id'],
-      'contributeMode' => 'direct',
-      'registerByID' => $cid,
-      'params' => [
-        [
-          'qfKey' => 'e6eb2903eae63d4c5c6cc70bfdda8741_2801',
-          'entryURL' => 'http://dmaster.local/civicrm/event/register?reset=1&amp;id=3',
-          'first_name' => 'k',
-          'last_name' => 'p',
-          'email-Other' => 'nonprimaryemail@example.com',
-          'hidden_processor' => '1',
-          'credit_card_number' => '4111111111111111',
-          'cvv2' => '123',
-          'credit_card_exp_date' => [
-            'M' => '1',
-            'Y' => '2019',
-          ],
-          'credit_card_type' => 'Visa',
-          'billing_first_name' => 'p',
-          'billing_middle_name' => '',
-          'billing_last_name' => 'p',
-          'billing_street_address-5' => 'p',
-          'billing_city-5' => 'p',
-          'billing_state_province_id-5' => '1061',
-          'billing_postal_code-5' => '7',
-          'billing_country_id-5' => '1228',
-          'priceSetId' => '6',
-          'price_7' => [
-            13 => 1,
-          ],
-          'payment_processor_id' => '1',
-          'bypass_payment' => '',
-          'MAX_FILE_SIZE' => '33554432',
-          'is_primary' => 1,
-          'is_pay_later' => 0,
-          'campaign_id' => NULL,
-          'defaultRole' => 1,
-          'participant_role_id' => '1',
-          'currencyID' => 'USD',
-          'amount_level' => '\ 1Tiny-tots (ages 5-8) - 1\ 1',
-          'amount' => '800.00',
-          'tax_amount' => NULL,
-          'year' => '2019',
-          'month' => '1',
-          'ip_address' => '127.0.0.1',
-          'invoiceID' => '57adc34957a29171948e8643ce906332',
-          'button' => '_qf_Register_upload',
-          'billing_state_province-5' => 'AP',
-          'billing_country-5' => 'US',
-        ],
+    $this->submitForm($event['id'], [
+      'first_name' => 'k',
+      'last_name' => 'p',
+      'email-Other' => 'nonprimaryemail@example.com',
+      'hidden_processor' => '1',
+      'credit_card_number' => '4111111111111111',
+      'cvv2' => '123',
+      'credit_card_exp_date' => [
+        'M' => '1',
+        'Y' => '2019',
       ],
+      'credit_card_type' => 'Visa',
+      'billing_first_name' => 'p',
+      'billing_middle_name' => '',
+      'billing_last_name' => 'p',
+      'billing_street_address-5' => 'p',
+      'billing_city-5' => 'p',
+      'billing_state_province_id-5' => '1061',
+      'billing_postal_code-5' => '7',
+      'billing_country_id-5' => '1228',
+      'priceSetId' => '6',
+      'price_7' => [
+        13 => 1,
+      ],
+      'payment_processor_id' => '1',
+      'bypass_payment' => '',
+      'MAX_FILE_SIZE' => '33554432',
+      'is_primary' => 1,
+      'is_pay_later' => 0,
+      'campaign_id' => NULL,
+      'defaultRole' => 1,
+      'participant_role_id' => '1',
+      'currencyID' => 'USD',
+      'amount_level' => '\ 1Tiny-tots (ages 5-8) - 1\ 1',
+      'amount' => '800.00',
+      'tax_amount' => NULL,
+      'year' => '2019',
+      'month' => '1',
+      'ip_address' => '127.0.0.1',
+      'invoiceID' => '57adc34957a29171948e8643ce906332',
+      'button' => '_qf_Register_upload',
+      'billing_state_province-5' => 'AP',
+      'billing_country-5' => 'US',
     ]);
-
     $mut->checkMailLog(['nonprimaryemail@example.com']);
     $mut->stop();
     $mut->clearMessages();