From: Seamus Lee Date: Fri, 19 Mar 2021 22:45:52 +0000 (+1100) Subject: [NFC] Fix test failures on PHP 7.4 caused by either NULL being set for the membership... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=26e40b3e321c3517250ea2dc2ef031a085d2c079;p=civicrm-core.git [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 --- 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 {