From f7483cd59bd2035c9ed21032f63004fa71c05054 Mon Sep 17 00:00:00 2001 From: Alexis Guyomar Date: Tue, 12 Nov 2024 09:35:27 +0100 Subject: [PATCH] fix: from review feedbacks --- classes/Parameters/UpgradeConfiguration.php | 1 + classes/UpgradePage.php | 2 +- .../self-managed/UpdatePageVersionChoiceController.php | 6 +++--- tests/unit/Parameters/ConfigurationValidatorTest.php | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/classes/Parameters/UpgradeConfiguration.php b/classes/Parameters/UpgradeConfiguration.php index 8beabc825..3dfe9a1d2 100644 --- a/classes/Parameters/UpgradeConfiguration.php +++ b/classes/Parameters/UpgradeConfiguration.php @@ -119,6 +119,7 @@ public function getLocalChannelVersion(): ?string /** * Get channel selected on config panel (Minor, major ...). + * @return Upgrader::CHANNEL_*|null */ public function getChannel(): ?string { diff --git a/classes/UpgradePage.php b/classes/UpgradePage.php index eb8285e69..47882397f 100644 --- a/classes/UpgradePage.php +++ b/classes/UpgradePage.php @@ -277,7 +277,7 @@ private function getJsParams(string $ajaxResult): array 'ajaxUpgradeTabExists' => file_exists($this->autoupgradePath . DIRECTORY_SEPARATOR . 'ajax-upgradetab.php'), 'currentIndex' => $this->currentIndex, 'tab' => 'AdminSelfUpgrade', - UpgradeConfiguration::CHANNEL => $this->config->get(UpgradeConfiguration::CHANNEL), + UpgradeConfiguration::CHANNEL => $this->config->getChannel(), 'autoupgrade' => [ 'version' => $this->upgradeSelfCheck->getModuleVersion(), ], diff --git a/controllers/admin/self-managed/UpdatePageVersionChoiceController.php b/controllers/admin/self-managed/UpdatePageVersionChoiceController.php index 6d72fa786..e08c3a57c 100644 --- a/controllers/admin/self-managed/UpdatePageVersionChoiceController.php +++ b/controllers/admin/self-managed/UpdatePageVersionChoiceController.php @@ -47,9 +47,9 @@ class UpdatePageVersionChoiceController extends AbstractPageController const CURRENT_STEP = UpdateSteps::STEP_VERSION_CHOICE; const FORM_NAME = 'version_choice'; const FORM_FIELDS = [ - 'channel' => UpgradeConfiguration::CHANNEL, - 'archive_zip' => UpgradeConfiguration::ARCHIVE_ZIP, - 'archive_xml' => UpgradeConfiguration::ARCHIVE_XML, + UpgradeConfiguration::CHANNEL => UpgradeConfiguration::CHANNEL, + UpgradeConfiguration::ARCHIVE_ZIP => UpgradeConfiguration::ARCHIVE_ZIP, + UpgradeConfiguration::ARCHIVE_XML => UpgradeConfiguration::ARCHIVE_XML, ]; const FORM_OPTIONS = [ 'online_value' => Upgrader::CHANNEL_ONLINE, diff --git a/tests/unit/Parameters/ConfigurationValidatorTest.php b/tests/unit/Parameters/ConfigurationValidatorTest.php index 65049028d..c60304cf8 100644 --- a/tests/unit/Parameters/ConfigurationValidatorTest.php +++ b/tests/unit/Parameters/ConfigurationValidatorTest.php @@ -83,7 +83,7 @@ public function testValidateZipSuccess() public function testValidateZipFail() { - $result = $this->validator->validate(['channel' => 'local', UpgradeConfiguration::ARCHIVE_ZIP => '']); + $result = $this->validator->validate([UpgradeConfiguration::CHANNEL => 'local', UpgradeConfiguration::ARCHIVE_ZIP => '']); $this->assertEquals([ [ 'message' => 'No zip archive provided',