Skip to content

Commit 0713296

Browse files
authored
Merge pull request #194 from magento-atwix-pyrrans/AC-2749-update-symfony
AC-2749 update Symfony dependencies to support latest LTS
2 parents c01b79b + b43484e commit 0713296

12 files changed

+45
-34
lines changed

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
"php": ">7.3",
1313
"ext-curl": "*",
1414
"ext-dom": "*",
15+
"ext-iconv": "*",
1516
"ext-intl": "*",
1617
"ext-json": "*",
1718
"ext-openssl": "*",
18-
"ext-iconv": "*",
1919
"allure-framework/allure-codeception": "^1.4",
2020
"aws/aws-sdk-php": "^3.132",
2121
"codeception/codeception": "^4.1",
@@ -31,12 +31,12 @@
3131
"nikic/php-parser": "^4.4",
3232
"php-webdriver/webdriver": "^1.9.0",
3333
"spomky-labs/otphp": "^10.0",
34-
"symfony/console": "^4.4",
34+
"symfony/console": "^4.4||^5.4",
3535
"symfony/dotenv": "^5.3",
3636
"symfony/finder": "^5.0",
3737
"symfony/http-foundation": "^5.0",
3838
"symfony/mime": "^5.0",
39-
"symfony/process": "^4.4",
39+
"symfony/process": "^4.4||^5.4",
4040
"weew/helpers-array": "^1.3"
4141
},
4242
"require-dev": {

composer.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

etc/config/command.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
$valid = validateCommand($magentoBinary, $command);
2525
if ($valid) {
2626
$fullCommand = escapeshellcmd($magentoBinary . " $command" . " $arguments");
27-
$process = new Symfony\Component\Process\Process($fullCommand);
27+
$process = Symfony\Component\Process\Process::fromShellCommandline($fullCommand);
2828
$process->setIdleTimeout($timeout);
2929
$process->setTimeout(0);
3030
$idleTimeout = false;

src/Magento/FunctionalTestingFramework/Console/BuildProjectCommand.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
*/
2929
class BuildProjectCommand extends Command
3030
{
31-
const DEFAULT_YAML_INLINE_DEPTH = 10;
31+
private const SUCCESS_EXIT_CODE = 0;
32+
public const DEFAULT_YAML_INLINE_DEPTH = 10;
3233

3334
/**
3435
* Env processor manages .env files.
@@ -65,11 +66,11 @@ protected function configure()
6566
*
6667
* @param InputInterface $input
6768
* @param OutputInterface $output
68-
* @return void
69+
* @return integer
6970
* @throws \Exception
7071
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
7172
*/
72-
protected function execute(InputInterface $input, OutputInterface $output)
73+
protected function execute(InputInterface $input, OutputInterface $output): int
7374
{
7475
$resetCommand = new CleanProjectCommand();
7576
$resetOptions = new ArrayInput([]);
@@ -91,7 +92,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
9192

9293
// TODO can we just import the codecept symfony command?
9394
$codeceptBuildCommand = realpath(PROJECT_ROOT . '/vendor/bin/codecept') . ' build';
94-
$process = new Process($codeceptBuildCommand);
95+
$process = Process::fromShellCommandline($codeceptBuildCommand);
9596
$process->setWorkingDirectory(TESTS_BP);
9697
$process->setIdleTimeout(600);
9798
$process->setTimeout(0);
@@ -112,6 +113,8 @@ function ($type, $buffer) use ($output) {
112113
$upgradeOptions = new ArrayInput([]);
113114
$upgradeCommand->run($upgradeOptions, $output);
114115
}
116+
117+
return self::SUCCESS_EXIT_CODE;
115118
}
116119

117120
/**

src/Magento/FunctionalTestingFramework/Console/CleanProjectCommand.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
class CleanProjectCommand extends Command
2020
{
21+
private const SUCCESS_EXIT_CODE = 0;
22+
2123
/**
2224
* Configures the current command.
2325
*
@@ -37,11 +39,11 @@ protected function configure()
3739
*
3840
* @param InputInterface $input
3941
* @param OutputInterface $output
40-
* @return void
42+
* @return integer
4143
* @throws \Symfony\Component\Console\Exception\LogicException
4244
* @throws TestFrameworkException
4345
*/
44-
protected function execute(InputInterface $input, OutputInterface $output)
46+
protected function execute(InputInterface $input, OutputInterface $output): int
4547
{
4648
$configFiles = [
4749
// codeception.yml file for top level config
@@ -97,5 +99,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
9799
}
98100

99101
$output->writeln('mftf files removed from filesystem.');
102+
103+
return self::SUCCESS_EXIT_CODE;
100104
}
101105
}

src/Magento/FunctionalTestingFramework/Console/GenerateDevUrnCommand.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@
1919

2020
class GenerateDevUrnCommand extends Command
2121
{
22+
private const SUCCESS_EXIT_CODE = 0;
2223
/**
2324
* Argument for the path to IDE config file
2425
*/
25-
const IDE_FILE_PATH_ARGUMENT = 'path';
26+
public const IDE_FILE_PATH_ARGUMENT = 'path';
2627

27-
const PROJECT_PATH_IDENTIFIER = '$PROJECT_DIR$';
28-
const MFTF_SRC_PATH = 'src/Magento/FunctionalTestingFramework/';
28+
public const PROJECT_PATH_IDENTIFIER = '$PROJECT_DIR$';
29+
public const MFTF_SRC_PATH = 'src/Magento/FunctionalTestingFramework/';
2930

3031
/**
3132
* Configures the current command.
@@ -54,10 +55,10 @@ protected function configure()
5455
*
5556
* @param InputInterface $input
5657
* @param OutputInterface $output
57-
* @return void
58+
* @return int
5859
* @throws \Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException
5960
*/
60-
protected function execute(InputInterface $input, OutputInterface $output)
61+
protected function execute(InputInterface $input, OutputInterface $output): int
6162
{
6263
$miscXmlFilePath = $input->getArgument(self::IDE_FILE_PATH_ARGUMENT);
6364
$miscXmlFile = realpath($miscXmlFilePath);
@@ -117,6 +118,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
117118
//Save output
118119
$dom->save($miscXmlFile);
119120
$output->writeln("MFTF URN mapping successfully added to {$miscXmlFile}.");
121+
122+
return self::SUCCESS_EXIT_CODE;
120123
}
121124

122125
/**

src/Magento/FunctionalTestingFramework/Console/RunManifestCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ private function runManifestLine($manifestLine, $output, $exit = false)
131131
. " run functional --verbose --steps " . $manifestLine;
132132

133133
// run the codecept command in a sub process
134-
$process = new Process($codeceptionCommand);
134+
$process = Process::fromShellCommandline($codeceptionCommand);
135135
$process->setWorkingDirectory(TESTS_BP);
136136
$process->setIdleTimeout(600);
137137
$process->setTimeout(0);

src/Magento/FunctionalTestingFramework/Console/RunTestCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ private function runTestsInSuite(array $suitesConfig, OutputInterface $output, I
261261
*/
262262
private function executeTestCommand(string $command, OutputInterface $output)
263263
{
264-
$process = new Process($command);
264+
$process = Process::fromShellCommandline($command);
265265
$process->setWorkingDirectory(TESTS_BP);
266266
$process->setIdleTimeout(600);
267267
$process->setTimeout(0);

src/Magento/FunctionalTestingFramework/Console/RunTestFailedCommand.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,9 @@
77

88
namespace Magento\FunctionalTestingFramework\Console;
99

10-
use Magento\FunctionalTestingFramework\Config\MftfApplicationConfig;
11-
use Magento\FunctionalTestingFramework\Util\Path\FilePathFormatter;
12-
use Symfony\Component\Console\Input\ArrayInput;
1310
use Symfony\Component\Console\Input\InputInterface;
1411
use Symfony\Component\Console\Output\OutputInterface;
1512
use Symfony\Component\Process\Process;
16-
use Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException;
17-
use Symfony\Component\Console\Input\InputOption;
1813

1914
class RunTestFailedCommand extends BaseGenerateCommand
2015
{
@@ -78,7 +73,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7873
$codeceptionCommand = realpath(PROJECT_ROOT . '/vendor/bin/codecept') . ' run functional ';
7974
$codeceptionCommand .= $testManifestList[$i];
8075

81-
$process = new Process($codeceptionCommand);
76+
$process = Process::fromShellCommandline($codeceptionCommand);
8277
$process->setWorkingDirectory(TESTS_BP);
8378
$process->setIdleTimeout(600);
8479
$process->setTimeout(0);

src/Magento/FunctionalTestingFramework/Console/RunTestGroupCommand.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,15 @@
77

88
namespace Magento\FunctionalTestingFramework\Console;
99

10-
use Magento\FunctionalTestingFramework\Suite\Handlers\SuiteObjectHandler;
1110
use Magento\FunctionalTestingFramework\Config\MftfApplicationConfig;
12-
use Magento\FunctionalTestingFramework\Test\Handlers\TestObjectHandler;
11+
use Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException;
1312
use Magento\FunctionalTestingFramework\Util\GenerationErrorHandler;
1413
use Symfony\Component\Console\Input\ArrayInput;
1514
use Symfony\Component\Console\Input\InputArgument;
1615
use Symfony\Component\Console\Input\InputInterface;
1716
use Symfony\Component\Console\Input\InputOption;
1817
use Symfony\Component\Console\Output\OutputInterface;
1918
use Symfony\Component\Process\Process;
20-
use Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException;
2119

2220
class RunTestGroupCommand extends BaseGenerateCommand
2321
{
@@ -133,7 +131,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
133131
}
134132
$returnCodes[] = $this->codeceptRunTest($codeceptionCommandString, $output);
135133
} else {
136-
$process = new Process($codeceptionCommandString);
134+
$process = Process::fromShellCommandline($codeceptionCommandString);
137135
$process->setWorkingDirectory(TESTS_BP);
138136
$process->setIdleTimeout(600);
139137
$process->setTimeout(0);

src/Magento/FunctionalTestingFramework/Console/SetupEnvCommand.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
class SetupEnvCommand extends Command
2020
{
21+
private const SUCCESS_EXIT_CODE = 0;
22+
2123
/**
2224
* Env processor manages .env files.
2325
*
@@ -47,10 +49,10 @@ protected function configure()
4749
*
4850
* @param InputInterface $input
4951
* @param OutputInterface $output
50-
* @return void
52+
* @return integer
5153
* @throws \Symfony\Component\Console\Exception\LogicException
5254
*/
53-
protected function execute(InputInterface $input, OutputInterface $output)
55+
protected function execute(InputInterface $input, OutputInterface $output): int
5456
{
5557
$config = $this->envProcessor->getEnv();
5658
$userEnv = [];
@@ -62,5 +64,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
6264
}
6365
$this->envProcessor->putEnvFile($userEnv);
6466
$output->writeln(".env configuration successfully applied.");
67+
68+
return self::SUCCESS_EXIT_CODE;
6569
}
6670
}

src/Magento/FunctionalTestingFramework/Console/UpgradeTestsCommand.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
class UpgradeTestsCommand extends Command
1919
{
20+
private const SUCCESS_EXIT_CODE = 0;
21+
2022
/**
2123
* Pool of upgrade scripts to run
2224
*
@@ -46,10 +48,10 @@ protected function configure()
4648
*
4749
* @param InputInterface $input
4850
* @param OutputInterface $output
49-
* @return int|null|void
51+
* @return int
5052
* @throws \Exception
5153
*/
52-
protected function execute(InputInterface $input, OutputInterface $output)
54+
protected function execute(InputInterface $input, OutputInterface $output): int
5355
{
5456
/** @var \Magento\FunctionalTestingFramework\Upgrade\UpgradeInterface[] $upgradeScriptObjects */
5557
$upgradeScriptObjects = $this->upgradeScriptsList->getUpgradeScripts();
@@ -59,5 +61,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
5961
LoggingUtil::getInstance()->getLogger(get_class($upgradeScriptObject))->info($upgradeOutput);
6062
$output->writeln($upgradeOutput . PHP_EOL);
6163
}
64+
65+
return self::SUCCESS_EXIT_CODE;
6266
}
6367
}

0 commit comments

Comments
 (0)