Stop calling BAO function in test
authorEileen McNaughton <emcnaughton@wikimedia.org>
Wed, 10 Aug 2022 21:39:34 +0000 (09:39 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Wed, 10 Aug 2022 21:40:39 +0000 (09:40 +1200)
tests/phpunit/CRM/Contribute/Import/Parser/ContributionTest.php

index e1463439fabdc93a7d4379381c8dc9b392d258aa..7375c6b1d78c2894f8b86477c9108c3af1729f6a 100644 (file)
@@ -226,7 +226,10 @@ class CRM_Contribute_Import_Parser_ContributionTest extends CiviUnitTestCase {
       'rule_weight' => 10,
       'rule_field' => 'phone_numeric',
     ]);
-    $fields = CRM_Contribute_BAO_Contribution::importableFields();
+    $userJobID = UserJob::create()->setValues(['job_type:name' => 'Import Contributions', 'status_id:name' => 'Draft', 'metadata' => ['contactType' => 'Individual']])->execute()->first()['id'];
+    $parser = new CRM_Contribute_Import_Parser_Contribution();
+    $parser ->setUserJobID($userJobID);
+    $fields = $parser->getAvailableFields();
     $this->assertArrayHasKey('phone', $fields);
     $this->callApiSuccess('RuleGroup', 'create', [
       'id' => $unsupervisedRuleGroup['id'],