diff --git a/tests/phpunit/CRM/Batch/Form/EntryTest.php b/tests/phpunit/CRM/Batch/Form/EntryTest.php index d8d6fda2ca7d..67a04ddb1267 100644 --- a/tests/phpunit/CRM/Batch/Form/EntryTest.php +++ b/tests/phpunit/CRM/Batch/Form/EntryTest.php @@ -151,8 +151,6 @@ public function setUp(): void { $session = CRM_Core_Session::singleton(); $session->set('dateTypes', 1); - $this->_sethtmlGlobals(); - } /** diff --git a/tests/phpunit/CRM/Case/BAO/CaseTest.php b/tests/phpunit/CRM/Case/BAO/CaseTest.php index e9d200d719bf..066788415cb3 100644 --- a/tests/phpunit/CRM/Case/BAO/CaseTest.php +++ b/tests/phpunit/CRM/Case/BAO/CaseTest.php @@ -389,12 +389,6 @@ public function testGetRelatedCases() { /** * Test various things after a case is closed. - * - * This annotation is not ideal, but without it there is some kind of - * messup that happens to quickform that persists between tests, e.g. - * it can't add maxfilesize validation rules. - * @runInSeparateProcess - * @preserveGlobalState disabled */ public function testCaseClosure() { $loggedInUser = $this->createLoggedInUser(); diff --git a/tests/phpunit/CRM/Contact/Form/Task/EmailTest.php b/tests/phpunit/CRM/Contact/Form/Task/EmailTest.php index e7f05091f320..1f7d581e3df6 100644 --- a/tests/phpunit/CRM/Contact/Form/Task/EmailTest.php +++ b/tests/phpunit/CRM/Contact/Form/Task/EmailTest.php @@ -104,11 +104,6 @@ public function testPostProcessWithSignature(): void { $form->_allContactIds = $form->_toContactIds = $form->_contactIds; $form->_fromEmails = [$loggedInEmail['id'] => 'mickey@mouse.com']; - // This rule somehow disappears if there's a form-related test before us, - // so register it again. See packages/HTML/QuickForm/file.php. - // update - actually - it's never registered. Even in form made - // I can see it missing - It's really weird. - $form->registerRule('maxfilesize', 'callback', '_ruleCheckMaxFileSize', 'HTML_QuickForm_file'); $form->isSearchContext = FALSE; $form->buildForm(); $form->submit(array_merge($form->_defaultValues, [ diff --git a/tests/phpunit/CRM/Core/DAOConformanceTest.php b/tests/phpunit/CRM/Core/DAOConformanceTest.php index faaa32ab6319..a89af22d8931 100644 --- a/tests/phpunit/CRM/Core/DAOConformanceTest.php +++ b/tests/phpunit/CRM/Core/DAOConformanceTest.php @@ -3,36 +3,21 @@ /** * Class for testing new DAO meet required standards. * - * Class CRM_Core_DAOTest * @group headless */ class CRM_Core_DAOConformanceTest extends CiviUnitTestCase { /** * Check all fields have defined titles. - * - * @dataProvider getAllDAO */ - public function testFieldsHaveTitles($class) { - $dao = new $class(); - $fields = $dao->fields(); - foreach ($fields as $name => $field) { - $this->assertArrayHasKey('title', $field, "A title must be defined for $name in $class"); + public function testFieldsHaveTitles() { + foreach (CRM_Core_DAO_AllCoreTables::getClasses() as $class) { + $dao = new $class(); + $fields = $dao->fields(); + foreach ($fields as $name => $field) { + $this->assertArrayHasKey('title', $field, "A title must be defined for $name in $class"); + } } } - /** - * Get all DAO classes. - */ - public function getAllDAO() { - // Ugh. Need full bootstrap to enumerate classes. - $this->setUp(); - $classList = CRM_Core_DAO_AllCoreTables::getClasses(); - $return = []; - foreach ($classList as $class) { - $return[] = [$class]; - } - return $return; - } - } diff --git a/tests/phpunit/CRM/Core/FormTest.php b/tests/phpunit/CRM/Core/FormTest.php index 2f6d3f4599fc..8a89938ba752 100644 --- a/tests/phpunit/CRM/Core/FormTest.php +++ b/tests/phpunit/CRM/Core/FormTest.php @@ -28,10 +28,6 @@ public function testOpeningForms(string $url) { $_REQUEST[$param] = $value; } - require_once 'HTML/QuickForm.php'; - $form = new HTML_QuickForm(); - $form->registerRule('maxfilesize', 'callback', '_ruleCheckMaxFileSize', 'HTML_QuickForm_file'); - $item = CRM_Core_Invoke::getItem([$_GET['q']]); ob_start(); CRM_Core_Invoke::runItem($item); diff --git a/tests/phpunit/CRM/Core/I18n/LocaleTest.php b/tests/phpunit/CRM/Core/I18n/LocaleTest.php index eff8a8ae96a8..c0735b850c77 100644 --- a/tests/phpunit/CRM/Core/I18n/LocaleTest.php +++ b/tests/phpunit/CRM/Core/I18n/LocaleTest.php @@ -101,10 +101,6 @@ public function testUiLanguages() { /** * Quirk in strtolower does not handle "I" as expected, compared to mb_strtolower. - * I think setting locale messes up something that I don't know how to reset, - * so see if these help: - * @runInSeparateProcess - * @preserveGlobalState disabled */ public function testInsertTurkish() { CRM_Core_DAO::executeQuery("DROP TABLE IF EXISTS foo"); diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php index 8c3dbc2982e1..c3adf7364473 100644 --- a/tests/phpunit/CiviTest/CiviUnitTestCase.php +++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php @@ -405,7 +405,6 @@ protected function setUp(): void { error_reporting(E_ALL); $this->renameLabels(); - $this->_sethtmlGlobals(); $this->ensureMySQLMode(['IGNORE_SPACE', 'ERROR_FOR_DIVISION_BY_ZERO', 'STRICT_TRANS_TABLES']); } @@ -2248,178 +2247,6 @@ public function financialAccountDelete($name) { } } - /** - * FIXME: something NULLs $GLOBALS['_HTML_QuickForm_registered_rules'] when the tests are ran all together - * (NB unclear if this is still required) - */ - public function _sethtmlGlobals() { - $GLOBALS['_HTML_QuickForm_registered_rules'] = [ - 'required' => [ - 'html_quickform_rule_required', - 'HTML/QuickForm/Rule/Required.php', - ], - 'maxlength' => [ - 'html_quickform_rule_range', - 'HTML/QuickForm/Rule/Range.php', - ], - 'minlength' => [ - 'html_quickform_rule_range', - 'HTML/QuickForm/Rule/Range.php', - ], - 'rangelength' => [ - 'html_quickform_rule_range', - 'HTML/QuickForm/Rule/Range.php', - ], - 'email' => [ - 'html_quickform_rule_email', - 'HTML/QuickForm/Rule/Email.php', - ], - 'regex' => [ - 'html_quickform_rule_regex', - 'HTML/QuickForm/Rule/Regex.php', - ], - 'lettersonly' => [ - 'html_quickform_rule_regex', - 'HTML/QuickForm/Rule/Regex.php', - ], - 'alphanumeric' => [ - 'html_quickform_rule_regex', - 'HTML/QuickForm/Rule/Regex.php', - ], - 'numeric' => [ - 'html_quickform_rule_regex', - 'HTML/QuickForm/Rule/Regex.php', - ], - 'nopunctuation' => [ - 'html_quickform_rule_regex', - 'HTML/QuickForm/Rule/Regex.php', - ], - 'nonzero' => [ - 'html_quickform_rule_regex', - 'HTML/QuickForm/Rule/Regex.php', - ], - 'callback' => [ - 'html_quickform_rule_callback', - 'HTML/QuickForm/Rule/Callback.php', - ], - 'compare' => [ - 'html_quickform_rule_compare', - 'HTML/QuickForm/Rule/Compare.php', - ], - ]; - // FIXME: …ditto for $GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES'] - $GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES'] = [ - 'group' => [ - 'HTML/QuickForm/group.php', - 'HTML_QuickForm_group', - ], - 'hidden' => [ - 'HTML/QuickForm/hidden.php', - 'HTML_QuickForm_hidden', - ], - 'reset' => [ - 'HTML/QuickForm/reset.php', - 'HTML_QuickForm_reset', - ], - 'checkbox' => [ - 'HTML/QuickForm/checkbox.php', - 'HTML_QuickForm_checkbox', - ], - 'file' => [ - 'HTML/QuickForm/file.php', - 'HTML_QuickForm_file', - ], - 'image' => [ - 'HTML/QuickForm/image.php', - 'HTML_QuickForm_image', - ], - 'password' => [ - 'HTML/QuickForm/password.php', - 'HTML_QuickForm_password', - ], - 'radio' => [ - 'HTML/QuickForm/radio.php', - 'HTML_QuickForm_radio', - ], - 'button' => [ - 'HTML/QuickForm/button.php', - 'HTML_QuickForm_button', - ], - 'submit' => [ - 'HTML/QuickForm/submit.php', - 'HTML_QuickForm_submit', - ], - 'select' => [ - 'HTML/QuickForm/select.php', - 'HTML_QuickForm_select', - ], - 'hiddenselect' => [ - 'HTML/QuickForm/hiddenselect.php', - 'HTML_QuickForm_hiddenselect', - ], - 'text' => [ - 'HTML/QuickForm/text.php', - 'HTML_QuickForm_text', - ], - 'textarea' => [ - 'HTML/QuickForm/textarea.php', - 'HTML_QuickForm_textarea', - ], - 'fckeditor' => [ - 'HTML/QuickForm/fckeditor.php', - 'HTML_QuickForm_FCKEditor', - ], - 'tinymce' => [ - 'HTML/QuickForm/tinymce.php', - 'HTML_QuickForm_TinyMCE', - ], - 'dojoeditor' => [ - 'HTML/QuickForm/dojoeditor.php', - 'HTML_QuickForm_dojoeditor', - ], - 'link' => [ - 'HTML/QuickForm/link.php', - 'HTML_QuickForm_link', - ], - 'advcheckbox' => [ - 'HTML/QuickForm/advcheckbox.php', - 'HTML_QuickForm_advcheckbox', - ], - 'date' => [ - 'HTML/QuickForm/date.php', - 'HTML_QuickForm_date', - ], - 'static' => [ - 'HTML/QuickForm/static.php', - 'HTML_QuickForm_static', - ], - 'header' => [ - 'HTML/QuickForm/header.php', - 'HTML_QuickForm_header', - ], - 'html' => [ - 'HTML/QuickForm/html.php', - 'HTML_QuickForm_html', - ], - 'hierselect' => [ - 'HTML/QuickForm/hierselect.php', - 'HTML_QuickForm_hierselect', - ], - 'autocomplete' => [ - 'HTML/QuickForm/autocomplete.php', - 'HTML_QuickForm_autocomplete', - ], - 'xbutton' => [ - 'HTML/QuickForm/xbutton.php', - 'HTML_QuickForm_xbutton', - ], - 'advmultiselect' => [ - 'HTML/QuickForm/advmultiselect.php', - 'HTML_QuickForm_advmultiselect', - ], - ]; - } - /** * Set up an acl allowing contact to see 2 specified groups * - $this->_permissionedGroup & $this->_permissionedDisabledGroup