From 31a4159f65ad71b940f4b760d6cf0c9f661bd3f3 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Tue, 11 Oct 2022 07:37:23 +0100 Subject: [PATCH] Add unit test to hit class-loader issue --- .../Contribute/Import/Parser/ContributionTest.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/phpunit/CRM/Contribute/Import/Parser/ContributionTest.php b/tests/phpunit/CRM/Contribute/Import/Parser/ContributionTest.php index cd3b41d2b4..e9f184d57a 100644 --- a/tests/phpunit/CRM/Contribute/Import/Parser/ContributionTest.php +++ b/tests/phpunit/CRM/Contribute/Import/Parser/ContributionTest.php @@ -9,6 +9,7 @@ use Civi\Api4\ContributionSoft; use Civi\Api4\DedupeRule; use Civi\Api4\DedupeRuleGroup; use Civi\Api4\Email; +use Civi\Api4\Import; use Civi\Api4\Note; use Civi\Api4\OptionValue; use Civi\Api4\UserJob; @@ -43,6 +44,7 @@ class CRM_Contribute_Import_Parser_ContributionTest extends CiviUnitTestCase { DedupeRule::delete() ->addWhere('rule_table', '!=', 'civicrm_email') ->addWhere('dedupe_rule_group_id.name', '=', 'IndividualUnsupervised')->execute(); + $this->callAPISuccess('Extension', 'disable', ['key' => 'civiimport']); parent::tearDown(); } @@ -817,4 +819,14 @@ class CRM_Contribute_Import_Parser_ContributionTest extends CiviUnitTestCase { ]); } + /** + * Test the Import api works from the extension when the extension is enabled after the import. + */ + public function testEnableExtension(): void { + $this->importContributionsDotCSV(); + $this->callAPISuccess('Extension', 'enable', ['key' => 'civiimport']); + $result = Import::get($this->userJobID)->execute(); + $this->assertEquals('ERROR', $result->first()['_status']); + } + } -- 2.25.1