From e96504024670dba2a525755fd9cabd7c09714b2d Mon Sep 17 00:00:00 2001 From: demeritcowboy Date: Sun, 3 Oct 2021 18:37:45 -0400 Subject: [PATCH] array is expected --- CRM/Contact/Form/Task/EmailTrait.php | 5 +++++ tests/phpunit/CRM/Core/FormTest.php | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/CRM/Contact/Form/Task/EmailTrait.php b/CRM/Contact/Form/Task/EmailTrait.php index dd5bef8ca6..82c136ebbc 100644 --- a/CRM/Contact/Form/Task/EmailTrait.php +++ b/CRM/Contact/Form/Task/EmailTrait.php @@ -148,6 +148,11 @@ trait CRM_Contact_Form_Task_EmailTrait { if ($cid) { $this->_contactIds = explode(',', $cid); } + // The default in CRM_Core_Form_Task is null, but changing it there gives + // errors later. + if (is_null($this->_contactIds)) { + $this->_contactIds = []; + } if (count($this->_contactIds) > 1) { $this->_single = FALSE; } diff --git a/tests/phpunit/CRM/Core/FormTest.php b/tests/phpunit/CRM/Core/FormTest.php index 0041d19ac3..2f6d3f4599 100644 --- a/tests/phpunit/CRM/Core/FormTest.php +++ b/tests/phpunit/CRM/Core/FormTest.php @@ -28,6 +28,10 @@ class CRM_Core_FormTest extends CiviUnitTestCase { $_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); @@ -59,6 +63,9 @@ class CRM_Core_FormTest extends CiviUnitTestCase { 'Fulltext search' => [ 'civicrm/contact/search/custom?csid=15&reset=1', ], + 'New Email' => [ + 'civicrm/activity/email/add?atype=3&action=add&reset=1&context=standalone', + ], ]; } -- 2.25.1