From 9cbc69c9d5e8ed25df2eb215387d1187fcac1427 Mon Sep 17 00:00:00 2001 From: 4ctobias Date: Thu, 24 Jun 2021 11:07:46 +0200 Subject: [PATCH 1/4] magento/magento2#32679: setup:upgrade --dry-run does not work as expected by other dry-run-commands in Linux-environment - Switched --dry-run-Parameter to VALUE_NONE in UpgradeCommand.php - Switched --dry-run-Parameter to VALUE_NONE in InstallCommand.php --- setup/src/Magento/Setup/Console/Command/InstallCommand.php | 5 ++--- setup/src/Magento/Setup/Console/Command/UpgradeCommand.php | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/setup/src/Magento/Setup/Console/Command/InstallCommand.php b/setup/src/Magento/Setup/Console/Command/InstallCommand.php index 5176f51baea6d..2d99c5d4d184b 100644 --- a/setup/src/Magento/Setup/Console/Command/InstallCommand.php +++ b/setup/src/Magento/Setup/Console/Command/InstallCommand.php @@ -210,9 +210,8 @@ protected function configure() new InputOption( DryRunLogger::INPUT_KEY_DRY_RUN_MODE, null, - InputOption::VALUE_OPTIONAL, - 'Magento Installation will be run in dry-run mode', - false + InputOption::VALUE_NONE, + 'Magento Installation will be run in dry-run mode' ), ]); $this->setName('setup:install') diff --git a/setup/src/Magento/Setup/Console/Command/UpgradeCommand.php b/setup/src/Magento/Setup/Console/Command/UpgradeCommand.php index 948e77f81fd2c..14faf50a8aa80 100644 --- a/setup/src/Magento/Setup/Console/Command/UpgradeCommand.php +++ b/setup/src/Magento/Setup/Console/Command/UpgradeCommand.php @@ -118,9 +118,8 @@ protected function configure() new InputOption( DryRunLogger::INPUT_KEY_DRY_RUN_MODE, null, - InputOption::VALUE_OPTIONAL, - 'Magento Installation will be run in dry-run mode', - false + InputOption::VALUE_NONE, + 'Magento Installation will be run in dry-run mode' ) ]; $this->setName('setup:upgrade') From 93d1a509ae4f01211779149d63a4b2e06e748a60 Mon Sep 17 00:00:00 2001 From: 4ctobias Date: Thu, 1 Jul 2021 15:51:12 +0200 Subject: [PATCH 2/4] magento/magento2#32679: setup:upgrade --dry-run does not work as expected by other dry-run-commands in Linux-environment - Fixed test dry-run - now also arguments without value are supported --- .../framework/Magento/TestFramework/Deploy/CliCommand.php | 2 ++ .../setup-integration/testsuite/Magento/Setup/DryRunTest.php | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dev/tests/setup-integration/framework/Magento/TestFramework/Deploy/CliCommand.php b/dev/tests/setup-integration/framework/Magento/TestFramework/Deploy/CliCommand.php index 6c7fc0017d3da..98f37332c4756 100644 --- a/dev/tests/setup-integration/framework/Magento/TestFramework/Deploy/CliCommand.php +++ b/dev/tests/setup-integration/framework/Magento/TestFramework/Deploy/CliCommand.php @@ -201,6 +201,8 @@ private function toCliArguments(array $params) foreach ($params as $key => $value) { if (!empty($value)) { $result["--{$key}=%s"] = $value; + } else { + $result["--{$key}"] = null; } } diff --git a/dev/tests/setup-integration/testsuite/Magento/Setup/DryRunTest.php b/dev/tests/setup-integration/testsuite/Magento/Setup/DryRunTest.php index 191ba635a35b6..de5966b1ae4dc 100644 --- a/dev/tests/setup-integration/testsuite/Magento/Setup/DryRunTest.php +++ b/dev/tests/setup-integration/testsuite/Magento/Setup/DryRunTest.php @@ -43,7 +43,7 @@ public function testDryRunOnCleanDatabase() $logFileName = TESTS_TEMP_DIR . '/var/log/' . DryRunLogger::FILE_NAME; $this->cliCommad->install( ['Magento_TestSetupDeclarationModule1'], - ['dry-run' => true] + ['dry-run' => null] ); self::assertFileExists($logFileName); $data = file_get_contents($logFileName); @@ -64,7 +64,7 @@ public function testDryRunOnUpgrade() 'db_schema.xml', 'etc' ); - $this->cliCommad->upgrade(['dry-run' => true]); + $this->cliCommad->upgrade(['dry-run' => null]); self::assertFileExists($logFileName); $data = file_get_contents($logFileName); self::assertEquals($this->getData()[0], $data); From 878e4807b3b99915f55e6782d5e177ffcd413cd7 Mon Sep 17 00:00:00 2001 From: 4ctobias Date: Thu, 1 Jul 2021 21:02:05 +0200 Subject: [PATCH 3/4] magento/magento2#32679: setup:upgrade --dry-run does not work as expected by other dry-run-commands in Linux-environment - Fixed cli-param-handling on tests for detecting parameters that should have no value - and discarding parameters that should removed for the test as no value was specified --- .../framework/Magento/TestFramework/Deploy/CliCommand.php | 6 +++--- .../testsuite/Magento/Setup/DryRunTest.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dev/tests/setup-integration/framework/Magento/TestFramework/Deploy/CliCommand.php b/dev/tests/setup-integration/framework/Magento/TestFramework/Deploy/CliCommand.php index 98f37332c4756..b2681faf42f96 100644 --- a/dev/tests/setup-integration/framework/Magento/TestFramework/Deploy/CliCommand.php +++ b/dev/tests/setup-integration/framework/Magento/TestFramework/Deploy/CliCommand.php @@ -199,10 +199,10 @@ private function toCliArguments(array $params) $result = []; foreach ($params as $key => $value) { - if (!empty($value)) { - $result["--{$key}=%s"] = $value; - } else { + if ($value === $key) { $result["--{$key}"] = null; + } elseif (!empty($value)) { + $result["--{$key}=%s"] = $value; } } diff --git a/dev/tests/setup-integration/testsuite/Magento/Setup/DryRunTest.php b/dev/tests/setup-integration/testsuite/Magento/Setup/DryRunTest.php index de5966b1ae4dc..29e3cfcddf62e 100644 --- a/dev/tests/setup-integration/testsuite/Magento/Setup/DryRunTest.php +++ b/dev/tests/setup-integration/testsuite/Magento/Setup/DryRunTest.php @@ -43,7 +43,7 @@ public function testDryRunOnCleanDatabase() $logFileName = TESTS_TEMP_DIR . '/var/log/' . DryRunLogger::FILE_NAME; $this->cliCommad->install( ['Magento_TestSetupDeclarationModule1'], - ['dry-run' => null] + ['dry-run' => 'dry-run'] ); self::assertFileExists($logFileName); $data = file_get_contents($logFileName); @@ -64,7 +64,7 @@ public function testDryRunOnUpgrade() 'db_schema.xml', 'etc' ); - $this->cliCommad->upgrade(['dry-run' => null]); + $this->cliCommad->upgrade(['dry-run' => 'dry-run']); self::assertFileExists($logFileName); $data = file_get_contents($logFileName); self::assertEquals($this->getData()[0], $data); From 9e193541501060075ed97926d035c014adff0ba1 Mon Sep 17 00:00:00 2001 From: engcom-Dash Date: Fri, 4 Oct 2024 16:19:17 +0530 Subject: [PATCH 4/4] 33332: Fix PHPCS error related to deprecation tag --- .../framework/Magento/TestFramework/Deploy/CliCommand.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dev/tests/setup-integration/framework/Magento/TestFramework/Deploy/CliCommand.php b/dev/tests/setup-integration/framework/Magento/TestFramework/Deploy/CliCommand.php index b2681faf42f96..bb7cee695ed2c 100644 --- a/dev/tests/setup-integration/framework/Magento/TestFramework/Deploy/CliCommand.php +++ b/dev/tests/setup-integration/framework/Magento/TestFramework/Deploy/CliCommand.php @@ -117,6 +117,7 @@ public function disableModule($moduleName) * @return void * @throws LocalizedException * @deprecated split database solution is deprecated and will be removed + * @see Nothing */ public function splitQuote() { @@ -141,6 +142,7 @@ public function splitQuote() * @return void * @throws LocalizedException * @deprecated split database solution is deprecated and will be removed + * @see Nothing */ public function splitSales() {