Skip to content

Commit d4581b4

Browse files
committed
#337: return the exit codes of the processes run within the command
1 parent a86f010 commit d4581b4

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

src/Magento/FunctionalTestingFramework/Console/RunTestCommand.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ protected function configure()
4646
*
4747
* @param InputInterface $input
4848
* @param OutputInterface $output
49-
* @return integer|null|void
49+
* @return int
5050
* @throws \Exception
5151
*
5252
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
5353
*/
54-
protected function execute(InputInterface $input, OutputInterface $output)
54+
protected function execute(InputInterface $input, OutputInterface $output): int
5555
{
5656
$tests = $input->getArgument('name');
5757
$skipGeneration = $input->getOption('skip-generate');
@@ -85,7 +85,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
8585
$process->setWorkingDirectory(TESTS_BP);
8686
$process->setIdleTimeout(600);
8787
$process->setTimeout(0);
88-
$process->run(
88+
89+
return $process->run(
8990
function ($type, $buffer) use ($output) {
9091
$output->write($buffer);
9192
}

src/Magento/FunctionalTestingFramework/Console/RunTestFailedCommand.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ protected function configure()
5959
*
6060
* @param InputInterface $input
6161
* @param OutputInterface $output
62-
* @return integer|null|void
62+
* @return int
6363
* @throws \Exception
6464
*
6565
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
6666
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
6767
*/
68-
protected function execute(InputInterface $input, OutputInterface $output)
68+
protected function execute(InputInterface $input, OutputInterface $output): int
6969
{
7070
// Create Mftf Configuration
7171
MftfApplicationConfig::create(
@@ -87,7 +87,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
8787
$command->run(new ArrayInput($args), $output);
8888

8989
$testManifestList = $this->readTestManifestFile();
90-
90+
$returnCode = 0;
9191
foreach ($testManifestList as $testCommand) {
9292
$codeceptionCommand = realpath(PROJECT_ROOT . '/vendor/bin/codecept') . ' run functional ';
9393
$codeceptionCommand .= $testCommand;
@@ -96,11 +96,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
9696
$process->setWorkingDirectory(TESTS_BP);
9797
$process->setIdleTimeout(600);
9898
$process->setTimeout(0);
99-
$process->run(
99+
$returnCode = max($returnCode, $process->run(
100100
function ($type, $buffer) use ($output) {
101101
$output->write($buffer);
102102
}
103-
);
103+
));
104104
if (file_exists(self::TESTS_FAILED_FILE)) {
105105
$this->failedList = array_merge(
106106
$this->failedList,
@@ -111,6 +111,8 @@ function ($type, $buffer) use ($output) {
111111
foreach ($this->failedList as $test) {
112112
$this->writeFailedTestToFile($test, self::TESTS_FAILED_FILE);
113113
}
114+
115+
return $returnCode;
114116
}
115117

116118
/**

src/Magento/FunctionalTestingFramework/Console/RunTestGroupCommand.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ protected function configure()
5353
*
5454
* @param InputInterface $input
5555
* @param OutputInterface $output
56-
* @return integer|null|void
56+
* @return int
5757
* @throws \Exception
5858
*
5959
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
6060
*/
61-
protected function execute(InputInterface $input, OutputInterface $output)
61+
protected function execute(InputInterface $input, OutputInterface $output): int
6262
{
6363
$skipGeneration = $input->getOption('skip-generate');
6464
$force = $input->getOption('force');
@@ -102,7 +102,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
102102
$process->setWorkingDirectory(TESTS_BP);
103103
$process->setIdleTimeout(600);
104104
$process->setTimeout(0);
105-
$process->run(
105+
106+
return $process->run(
106107
function ($type, $buffer) use ($output) {
107108
$output->write($buffer);
108109
}

0 commit comments

Comments
 (0)