From 26e40b3e321c3517250ea2dc2ef031a085d2c079 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Sat, 20 Mar 2021 09:45:52 +1100 Subject: [PATCH] [NFC] Fix test failures on PHP 7.4 caused by either NULL being set for the membership_type_id or Payment Processor not being set on the form --- CRM/Member/Form.php | 2 +- tests/phpunit/CRM/Event/Form/ParticipantTest.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CRM/Member/Form.php b/CRM/Member/Form.php index 1c9313c16b..5b65b75372 100644 --- a/CRM/Member/Form.php +++ b/CRM/Member/Form.php @@ -497,7 +497,7 @@ class CRM_Member_Form extends CRM_Contribute_Form_AbstractEditPayment { public function testSubmit(array $formValues): void { $this->exportedValues = $formValues; $this->setContextVariables($formValues); - $this->_memType = $formValues['membership_type_id'][1]; + $this->_memType = !empty($formValues['membership_type_id']) ? $formValues['membership_type_id'][1] : NULL; $this->_params = $formValues; $this->submit(); } diff --git a/tests/phpunit/CRM/Event/Form/ParticipantTest.php b/tests/phpunit/CRM/Event/Form/ParticipantTest.php index cdb0ae133c..be2c61ffca 100644 --- a/tests/phpunit/CRM/Event/Form/ParticipantTest.php +++ b/tests/phpunit/CRM/Event/Form/ParticipantTest.php @@ -351,6 +351,7 @@ class CRM_Event_Form_ParticipantTest extends CiviUnitTestCase { $form->_bltID = 5; $form->_isPaidEvent = TRUE; CRM_Event_Form_EventFees::preProcess($form); + $form->assignProcessors(); $form->buildEventFeeForm($form); } else { -- 2.25.1