Fix test set up
authorEileen McNaughton <emcnaughton@wikimedia.org>
Fri, 28 Jul 2023 02:22:01 +0000 (14:22 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Wed, 2 Aug 2023 09:09:58 +0000 (21:09 +1200)
CRM/Contribute/Form/ContributionBase.php
tests/phpunit/CRM/Contribute/Form/ContributionTest.php

index 2fee4a089a178bef72466b10743408ff9c47ca4e..36422a48f3b8fcb083f630d3e254c782fb27f152 100644 (file)
@@ -361,7 +361,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form {
       $this->order->setPriceSetID($this->getPriceSetID());
     }
     else {
-      CRM_Core_Error::deprecatedFunctionWarning('forms require a price set it');
+      CRM_Core_Error::deprecatedFunctionWarning('forms require a price set ID');
     }
     $this->_priceSet = $this->get('priceSet');
 
index 39f0f2f2455597a89c456f10482c812a76a6b1db..73139803598fd98091429eed1a7409a3ed99a0f9 100644 (file)
@@ -12,6 +12,7 @@
 use Civi\Api4\MembershipBlock;
 use Civi\Api4\PriceField;
 use Civi\Api4\PriceSet;
+use Civi\Api4\PriceSetEntity;
 
 /**
  *  Test APIv3 civicrm_contribute_* functions
@@ -1383,11 +1384,12 @@ Paid By: Check',
       'receipt_from_name' => 'Ego Freud',
     ];
 
+    $_REQUEST['id'] = $this->callAPISuccess('ContributionPage', 'create', $params)['id'];
+    PriceSetEntity::create(FALSE)->setValues(['entity_id' => $_REQUEST['id'], 'entity_table' => 'civicrm_contribution_page', 'price_set_id:name' => 'default_contribution_amount'])->execute();
     // Execute CRM_Contribute_Form_ContributionBase preProcess (via child class).
     // Check the assignment of payment processors.
     /* @var \CRM_Contribute_Form_Contribution_Main $form */
     $form = $this->getFormObject('CRM_Contribute_Form_Contribution_Main', ['payment_processor_id' => 0]);
-    $_REQUEST['id'] = $this->callAPISuccess('ContributionPage', 'create', $params)['id'];
 
     $form->preProcess();
     $this->assertEquals('pay_later', $form->_paymentProcessor['name']);