Skip to content

Commit 12ca5e4

Browse files
committed
MQE-904: Deliver changes from Magento Contribution Day
1 parent 5f3438c commit 12ca5e4

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

RoboFile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function generateTests($opts = ['config' => null, 'force' => true, 'nodes' => nu
5454

5555
require 'dev' . DIRECTORY_SEPARATOR . 'tests'. DIRECTORY_SEPARATOR . 'functional' . DIRECTORY_SEPARATOR . '_bootstrap.php';
5656
\Magento\FunctionalTestingFramework\Util\TestGenerator::getInstance()
57-
->createAllTestFiles($opts['config'], $opts['nodes'], $opts['debug'], $this->getOutput());
57+
->createAllTestFiles($opts['config'], $opts['nodes'], $opts['debug']);
5858
$this->say("Generate Tests Command Run");
5959
}
6060

src/Magento/FunctionalTestingFramework/Util/TestGenerator.php

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,13 @@
2020
use Magento\FunctionalTestingFramework\Test\Util\ActionObjectExtractor;
2121
use Magento\FunctionalTestingFramework\Test\Util\TestObjectExtractor;
2222
use Magento\FunctionalTestingFramework\Util\Filesystem\DirSetupUtil;
23-
use Robo\Common\IO;
24-
use Symfony\Component\Console\Output\OutputInterface;
2523

2624
/**
2725
* Class TestGenerator
2826
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
2927
*/
3028
class TestGenerator
3129
{
32-
use IO;
33-
3430
const REQUIRED_ENTITY_REFERENCE = 'createDataKey';
3531
const GENERATED_DIR = '_generated';
3632

@@ -55,6 +51,13 @@ class TestGenerator
5551
*/
5652
private $tests;
5753

54+
/**
55+
* Symfony console output interface.
56+
*
57+
* @var \Symfony\Component\Console\Output\ConsoleOutput
58+
*/
59+
private $consoleOutput;
60+
5861
/**
5962
* TestGenerator constructor.
6063
*
@@ -70,6 +73,7 @@ private function __construct($exportDir, $tests)
7073
DIRECTORY_SEPARATOR
7174
);
7275
$this->tests = $tests;
76+
$this->consoleOutput = new \Symfony\Component\Console\Output\ConsoleOutput();
7377
}
7478

7579
/**
@@ -137,20 +141,19 @@ private function createCestFile($testPhp, $filename)
137141
* @param string $runConfig
138142
* @param int $nodes
139143
* @param bool $debug
140-
* @param OutputInterface|null $output
141144
* @return void
142145
* @throws TestReferenceException
143146
* @throws \Exception
144147
*/
145-
public function createAllTestFiles($runConfig = null, $nodes = null, $debug = false, $output = null)
148+
public function createAllTestFiles($runConfig = null, $nodes = null, $debug = false)
146149
{
147150
DirSetupUtil::createGroupDir($this->exportDirectory);
148-
if ($output !== null) {
149-
$this->setOutput($output);
150-
}
151-
152151
// create our manifest file here
153-
$testManifest = TestManifestFactory::makeManifest($this->exportDirectory, $runConfig);
152+
$testManifest = TestManifestFactory::makeManifest(
153+
dirname($this->exportDirectory),
154+
$this->exportDirectory,
155+
$runConfig
156+
);
154157
$testPhpArray = $this->assembleAllTestPhp($testManifest, $nodes, $debug);
155158

156159
foreach ($testPhpArray as $testPhpFile) {
@@ -219,7 +222,7 @@ private function assembleAllTestPhp($testManifest, $nodes, $debug = false)
219222
$debugInformation = $test->getDebugInformation();
220223

221224
$this->debug($debugInformation, $debug);
222-
$this->debug('Finish creating test ' . $test->getCodeceptionName(), $debug);
225+
$this->debug('Finish creating test ' . $test->getCodeceptionName() . PHP_EOL, $debug);
223226
}
224227

225228
$testManifest->generate($nodes);
@@ -239,7 +242,7 @@ private function debug($messages, $debug = false)
239242
if ($debug && $messages) {
240243
$messages = (array) $messages;
241244
foreach ($messages as $message) {
242-
$this->say($message);
245+
$this->consoleOutput->writeln($message);
243246
}
244247
}
245248
}

0 commit comments

Comments
 (0)