Skip to content

Commit 9d86d8f

Browse files
committed
Merge remote-tracking branch 'origin/develop' into admin-token-refresh
2 parents d82197b + 59d131f commit 9d86d8f

File tree

13 files changed

+1490
-1290
lines changed

13 files changed

+1490
-1290
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
*

dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ObjectExtensionUtilTest.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,41 @@ public function testExtendingExtendedActionGroup()
346346
}
347347
}
348348

349+
/**
350+
* Tests generating a test that extends a skipped parent test
351+
*
352+
* @throws \Exception
353+
*/
354+
public function testExtendedTestSkippedParent()
355+
{
356+
$testDataArrayBuilder = new TestDataArrayBuilder();
357+
$mockParentTest = $testDataArrayBuilder
358+
->withName('baseTest')
359+
->withAnnotations([
360+
'skip' => ['nodeName' => 'skip', 'issueId' => [['nodeName' => 'issueId', 'value' => 'someIssue']]]
361+
])
362+
->build();
363+
364+
$testDataArrayBuilder->reset();
365+
$mockExtendedTest = $testDataArrayBuilder
366+
->withName('extendTest')
367+
->withTestReference("baseTest")
368+
->build();
369+
370+
$mockTestData = array_merge($mockParentTest, $mockExtendedTest);
371+
$this->setMockTestOutput($mockTestData);
372+
373+
// parse and generate test object with mocked data
374+
TestObjectHandler::getInstance()->getObject('extendTest');
375+
376+
// validate log statement
377+
TestLoggingUtil::getInstance()->validateMockLogStatement(
378+
'debug',
379+
"extendTest is skipped due to ParentTestIsSkipped",
380+
[]
381+
);
382+
}
383+
349384
/**
350385
* Function used to set mock for parser return and force init method to run between tests.
351386
*

dev/tests/unit/Util/TestDataArrayBuilder.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,28 @@ public function withTestReference($reference = null)
232232
return $this;
233233
}
234234

235+
/**
236+
* Reset data array builder
237+
*
238+
* @return void
239+
*/
240+
public function reset()
241+
{
242+
// reset
243+
$this->testName = 'testTest';
244+
$this->filename = null;
245+
$this->testActionBeforeName = 'testActionBefore';
246+
$this->testActionAfterName = 'testActionAfter';
247+
$this->testActionFailedName = 'testActionFailed';
248+
$this->testActionType = 'testAction';
249+
$this->annotations = [];
250+
$this->beforeHook = [];
251+
$this->afterHook = [];
252+
$this->failedHook = [];
253+
$this->testReference = null;
254+
$this->testActions = [];
255+
}
256+
235257
/**
236258
* Output the resulting test data array based on parameters set in the object
237259
*

dev/tests/verification/Resources/ExtendingSkippedTest.txt

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,6 @@ use Yandex\Allure\Adapter\Annotation\TestCaseId;
1919
*/
2020
class ExtendingSkippedTestCest
2121
{
22-
/**
23-
* @param AcceptanceTester $I
24-
* @throws \Exception
25-
*/
26-
public function _before(AcceptanceTester $I)
27-
{
28-
$I->amOnPage("/beforeUrl"); // stepKey: beforeAmOnPageKey
29-
}
30-
31-
/**
32-
* @param AcceptanceTester $I
33-
* @throws \Exception
34-
*/
35-
public function _after(AcceptanceTester $I)
36-
{
37-
$I->amOnPage("/afterUrl"); // stepKey: afterAmOnPageKey
38-
}
39-
40-
/**
41-
* @param AcceptanceTester $I
42-
* @throws \Exception
43-
*/
44-
public function _failed(AcceptanceTester $I)
45-
{
46-
$I->saveScreenshot(); // stepKey: saveScreenshot
47-
}
48-
4922
/**
5023
* @Severity(level = SeverityLevel::CRITICAL)
5124
* @Features({"TestModule"})
@@ -55,9 +28,8 @@ class ExtendingSkippedTestCest
5528
* @return void
5629
* @throws \Exception
5730
*/
58-
public function ExtendingSkippedTest(AcceptanceTester $I)
31+
public function ExtendingSkippedTest(AcceptanceTester $I, \Codeception\Scenario $scenario)
5932
{
60-
$I->comment("text");
61-
$I->comment("child");
33+
$scenario->skip("This test is skipped due to the following issues:\nParentTestIsSkipped");
6234
}
6335
}

docs/extending.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ Specify needed variations for a parent object and produce a copy of the original
1515
Unlike merging, the parent test (or action group) will still exist after the test generation.
1616
</div>
1717

18+
<div class="bs-callout-warning" markdown="1">
19+
<br>
20+
Note: The extended test will be skipped if the parent test is skipped.
21+
</div>
22+
1823
## Extending tests
1924

2025
### Update a test step

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
{

0 commit comments

Comments
 (0)