From 3be0f16dee702b5a0179832faf36960673055d41 Mon Sep 17 00:00:00 2001 From: olayiwola-compucorp Date: Wed, 28 Sep 2022 14:42:58 +0100 Subject: [PATCH 1/4] MAE-891: Prevent accessing undefined index --- .../phpunit/CRM/EventsExtras/Hook/BuildForm/EventFeeTest.php | 4 ++-- .../phpunit/CRM/EventsExtras/Hook/BuildForm/EventInfoTest.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/CRM/EventsExtras/Hook/BuildForm/EventFeeTest.php b/tests/phpunit/CRM/EventsExtras/Hook/BuildForm/EventFeeTest.php index d93a3c4..7388b59 100644 --- a/tests/phpunit/CRM/EventsExtras/Hook/BuildForm/EventFeeTest.php +++ b/tests/phpunit/CRM/EventsExtras/Hook/BuildForm/EventFeeTest.php @@ -18,7 +18,7 @@ class CRM_EventsExtras_Hook_BuildForm_EventFeeTest extends BaseHeadlessTest { */ private $eventFeeForm; - public function setUp() { + public function setUp(): void { $formController = new CRM_Core_Controller(); $this->eventFeeForm = new CRM_Event_Form_ManageEvent_Fee(); $this->eventFeeForm->controller = $formController; @@ -26,7 +26,7 @@ public function setUp() { } public function testSetDefault() { - $this->assertNull($this->eventFeeForm->getElementValue('payment_processor')[0]); + $this->assertEmpty($this->eventFeeForm->getElementValue('payment_processor')); SettingFabricator::fabricate([ SettingsManager::SETTING_FIELDS['PAYMENT_PROCESSOR_SELECTION'] => 0, diff --git a/tests/phpunit/CRM/EventsExtras/Hook/BuildForm/EventInfoTest.php b/tests/phpunit/CRM/EventsExtras/Hook/BuildForm/EventInfoTest.php index 7e2415b..6fa47f1 100644 --- a/tests/phpunit/CRM/EventsExtras/Hook/BuildForm/EventInfoTest.php +++ b/tests/phpunit/CRM/EventsExtras/Hook/BuildForm/EventInfoTest.php @@ -23,7 +23,7 @@ public function testSetDefault() { $eventInfoForm->controller = $formController; $eventInfoForm->buildForm(); - $this->assertNull($eventInfoForm->getElementValue('default_role_id')[0]); + $this->assertEmpty($eventInfoForm->getElementValue('default_role_id')); SettingFabricator::fabricate([ SettingsManager::SETTING_FIELDS['ROLES'] => 0, From a6f8d74a1a8357869795a2da46b585bd334466db Mon Sep 17 00:00:00 2001 From: olayiwola-compucorp Date: Wed, 28 Sep 2022 14:44:16 +0100 Subject: [PATCH 2/4] MAE-891: Use PHP8.0 container --- .github/workflows/tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2cf9287..df9db1f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,7 +6,7 @@ jobs: run-unit-tests: runs-on: ubuntu-latest - container: compucorp/civicrm-buildkit:1.0.0 + container: compucorp/civicrm-buildkit:1.3.0-php8.0-chrome env: CIVICRM_EXTENSIONS_DIR: site/web/sites/all/modules/civicrm/tools/extensions @@ -29,14 +29,14 @@ jobs: run : amp config:set --mysql_dsn=mysql://root:root@mysql:3306 - name: Build Drupal site - run: civibuild create drupal-clean --civi-ver 5.28.3 --cms-ver 7.75 --web-root $GITHUB_WORKSPACE/site + run: civibuild create drupal-clean --civi-ver 5.51.3 --cms-ver 7.85 --web-root $GITHUB_WORKSPACE/site - uses: compucorp/apply-patch@1.0.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: repo: compucorp/civicrm-core - version: 5.28.3 + version: 5.51.3 path: site/web/sites/all/modules/civicrm - uses: actions/checkout@v2 From a36a609833c248c00107143189811341ba81dcdc Mon Sep 17 00:00:00 2001 From: olayiwola-compucorp Date: Wed, 28 Sep 2022 15:16:31 +0100 Subject: [PATCH 3/4] MAE-891: Use Drupal version 7.79 in test workflow --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index df9db1f..6044547 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -29,7 +29,7 @@ jobs: run : amp config:set --mysql_dsn=mysql://root:root@mysql:3306 - name: Build Drupal site - run: civibuild create drupal-clean --civi-ver 5.51.3 --cms-ver 7.85 --web-root $GITHUB_WORKSPACE/site + run: civibuild create drupal-clean --civi-ver 5.51.3 --cms-ver 7.79 --web-root $GITHUB_WORKSPACE/site - uses: compucorp/apply-patch@1.0.0 env: From ee10989d0017446eb0706d1bcae44a134a8cf44e Mon Sep 17 00:00:00 2001 From: olayiwola-compucorp Date: Fri, 2 Dec 2022 10:47:50 +0100 Subject: [PATCH 4/4] MAE-975: Fix settings page error The eventextras settings page was returning CiviCRM WSOD because it is mandatory in PHP8 for the first parameter in array_fill_key to be an array. --- CRM/EventsExtras/Form/Settings.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CRM/EventsExtras/Form/Settings.php b/CRM/EventsExtras/Form/Settings.php index 3ce210a..b64f694 100644 --- a/CRM/EventsExtras/Form/Settings.php +++ b/CRM/EventsExtras/Form/Settings.php @@ -249,7 +249,8 @@ public function setDefaultValues() { } $defaults['eventsextras_payment_processor_selection_default'] = - array_fill_keys($defaults['eventsextras_payment_processor_selection_default'], '1'); + is_array($defaults['eventsextras_payment_processor_selection_default']) ? + array_fill_keys($defaults['eventsextras_payment_processor_selection_default'], '1') : NULL; return $defaults; }