From 3ce20246fbe0e77c205082061ef5c64a2ffbb80b Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Wed, 6 Jul 2022 22:25:24 +1200 Subject: [PATCH] Adapt test to form cleanup --- tests/phpunit/CRM/Contact/Import/Form/DataSourceTest.php | 3 ++- tests/phpunit/CRM/Contact/Import/Form/MapFieldTest.php | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/CRM/Contact/Import/Form/DataSourceTest.php b/tests/phpunit/CRM/Contact/Import/Form/DataSourceTest.php index 64d7db013d..0be4ff52b4 100644 --- a/tests/phpunit/CRM/Contact/Import/Form/DataSourceTest.php +++ b/tests/phpunit/CRM/Contact/Import/Form/DataSourceTest.php @@ -42,7 +42,8 @@ class CRM_Contact_Import_Form_DataSourceTest extends CiviUnitTestCase { $this->callAPISuccess('Mapping', 'create', ['name' => 'Well dressed ducks', 'mapping_type_id' => 'Import Contact']); $form = $this->getFormObject('CRM_Contact_Import_Form_DataSource'); $form->buildQuickForm(); - $this->assertEquals([1 => 'Well dressed ducks'], CRM_Core_Smarty::singleton()->get_template_vars('savedMapping')); + $element = $form->getElement('savedMapping'); + $this->assertEquals('Well dressed ducks', $element->_options[1]['text']); } /** diff --git a/tests/phpunit/CRM/Contact/Import/Form/MapFieldTest.php b/tests/phpunit/CRM/Contact/Import/Form/MapFieldTest.php index 645a8df56c..e5b332e8e2 100644 --- a/tests/phpunit/CRM/Contact/Import/Form/MapFieldTest.php +++ b/tests/phpunit/CRM/Contact/Import/Form/MapFieldTest.php @@ -62,9 +62,9 @@ class CRM_Contact_Import_Form_MapFieldTest extends CiviUnitTestCase { * @throws \CiviCRM_API3_Exception */ public function testSubmit(array $params, array $mapper, array $expecteds = []): void { - $form = $this->getMapFieldFormObject(['mapper' => $mapper]); + $form = $this->getMapFieldFormObject(array_merge($params, ['mapper' => $mapper])); $form->preProcess(); - $form->submit($params); + $form->postProcess(); CRM_Core_DAO::executeQuery('DROP TABLE civicrm_tmp_d_import_job_xxx'); if (!empty($expecteds)) { -- 2.25.1