Skip to content

Commit f0966d0

Browse files
authored
Merge branch 'develop' into patch-1
2 parents a5346a4 + 7f0cf87 commit f0966d0

File tree

8 files changed

+1410
-1257
lines changed

8 files changed

+1410
-1257
lines changed

composer.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"codeception/module-sequence": "^1.0",
2323
"codeception/module-webdriver": "^1.0",
2424
"composer/composer": "^1.9",
25-
"csharpru/vault-php": "~3.5.3",
25+
"csharpru/vault-php": "^4.1.0",
2626
"csharpru/vault-php-guzzle6-transport": "^2.0",
2727
"hoa/console": "~3.0",
2828
"monolog/monolog": "^1.17",
@@ -35,7 +35,8 @@
3535
"symfony/mime": "^5.0",
3636
"symfony/process": "^4.4",
3737
"vlucas/phpdotenv": "^2.4",
38-
"weew/helpers-array": "^1.3"
38+
"weew/helpers-array": "^1.3",
39+
"nikic/php-parser": "~4.4.0"
3940
},
4041
"require-dev": {
4142
"brainmaestro/composer-git-hooks": "^2.3.1",
@@ -47,7 +48,7 @@
4748
"phpmd/phpmd": "^2.8.0",
4849
"phpunit/phpunit": "^9.0",
4950
"rregeer/phpunit-coverage-check": "^0.1.4",
50-
"sebastian/phpcpd": "~5.0.0",
51+
"sebastian/phpcpd": "~6.0.0",
5152
"squizlabs/php_codesniffer": "~3.5.4",
5253
"symfony/stopwatch": "~3.4.6"
5354
},

composer.lock

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

dev/tests/unit/Magento/FunctionalTestFramework/Suite/SuiteGeneratorTest.php

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,57 @@ public function testNonExistentSuiteTestPair()
226226
$this->assertArrayHasKey('Suite3', $suiteErrors);
227227
}
228228

229+
/**
230+
* Tests generating split suites for parallel test generation
231+
*/
232+
public function testGenerateSplitSuiteFromTest()
233+
{
234+
$suiteDataArrayBuilder = new SuiteDataArrayBuilder();
235+
$mockSuiteData = $suiteDataArrayBuilder
236+
->withName('mockSuite')
237+
->includeGroups(['group1'])
238+
->build();
239+
$testDataArrayBuilder = new TestDataArrayBuilder();
240+
$mockSimpleTest1 = $testDataArrayBuilder
241+
->withName('simpleTest1')
242+
->withAnnotations(['group' => [['value' => 'group1']]])
243+
->withTestReference("NonExistantTest")
244+
->withTestActions()
245+
->build();
246+
$mockSimpleTest2 = $testDataArrayBuilder
247+
->withName('simpleTest2')
248+
->withAnnotations(['group' => [['value' => 'group1']]])
249+
->withTestActions()
250+
->build();
251+
$mockSimpleTest3 = $testDataArrayBuilder
252+
->withName('simpleTest3')
253+
->withAnnotations(['group' => [['value' => 'group1']]])
254+
->withTestActions()
255+
->build();
256+
$mockTestData = array_merge($mockSimpleTest1, $mockSimpleTest2, $mockSimpleTest3);
257+
$this->setMockTestAndSuiteParserOutput($mockTestData, $mockSuiteData);
258+
259+
// Make manifest for split suites
260+
$suiteConfig = [
261+
'mockSuite' => [
262+
'mockSuite_0_G' => ['simpleTest1', 'simpleTest2'],
263+
'mockSuite_1_G' => ['simpleTest3'],
264+
],
265+
];
266+
$manifest = TestManifestFactory::makeManifest('default', $suiteConfig);
267+
268+
// parse and generate suite object with mocked data and manifest
269+
$mockSuiteGenerator = SuiteGenerator::getInstance();
270+
$mockSuiteGenerator->generateAllSuites($manifest);
271+
272+
// assert last split suite group generated
273+
TestLoggingUtil::getInstance()->validateMockLogStatement(
274+
'info',
275+
"suite generated",
276+
['suite' => 'mockSuite_1_G', 'relative_path' => "_generated" . DIRECTORY_SEPARATOR . "mockSuite_1_G"]
277+
);
278+
}
279+
229280
/**
230281
* Function used to set mock for parser return and force init method to run between tests.
231282
*

src/Magento/FunctionalTestingFramework/Console/BuildProjectCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ protected function configure()
6767
* @param OutputInterface $output
6868
* @return void
6969
* @throws \Exception
70-
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
70+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
7171
*/
7272
protected function execute(InputInterface $input, OutputInterface $output)
7373
{

src/Magento/FunctionalTestingFramework/Console/RunManifestCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
112112
* @return void
113113
* @throws \Exception
114114
*
115-
* @SuppressWarnings(PHPMD.UnusedLocalVariable) Need this because of the unused $type variable in the closure
115+
* @SuppressWarnings(PHPMD.UnusedFormalParameter) Need this because of the unused $type variable in the closure
116116
*/
117117
private function runManifestLine($manifestLine, $output, $exit = false)
118118
{

src/Magento/FunctionalTestingFramework/Console/RunTestCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ private function runTestsInSuite(array $suitesConfig, OutputInterface $output)
215215
* @param OutputInterface $output
216216
* @return integer
217217
*
218-
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
218+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
219219
*/
220220
private function executeTestCommand(string $command, OutputInterface $output)
221221
{

src/Magento/FunctionalTestingFramework/Console/RunTestGroupCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ protected function configure()
5252
* @return integer
5353
* @throws \Exception
5454
*
55-
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
55+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
5656
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
5757
* @SuppressWarnings(PHPMD.NPathComplexity)
5858
*/

src/Magento/FunctionalTestingFramework/Suite/SuiteGenerator.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,16 @@ private function validateTestsReferencedInSuite($suiteName, $testsReferenced, $o
265265
private function generateSplitSuiteFromTest($suiteName, $suiteContent)
266266
{
267267
foreach ($suiteContent as $suiteSplitName => $tests) {
268-
$this->generateSuiteFromTest($suiteSplitName, $tests, $suiteName);
268+
try {
269+
$this->generateSuiteFromTest($suiteSplitName, $tests, $suiteName);
270+
} catch (FastFailException $e) {
271+
throw $e;
272+
} catch (\Exception $e) {
273+
// There are suites that include tests that reference tests from other Magento editions
274+
// To keep backward compatibility, we will catch such exceptions with no error.
275+
// This might inevitably hide some suite errors that are resulted by tests with broken references
276+
//TODO MQE-2484
277+
}
269278
}
270279
}
271280

0 commit comments

Comments
 (0)