Skip to content

Commit c9c39df

Browse files
authored
Merge pull request #10 from magento-pangolin/MQE-2316
MQE-2316: MFTF SVC does not check newly added modules
2 parents 4abcf65 + 2048437 commit c9c39df

File tree

29 files changed

+509
-2
lines changed

29 files changed

+509
-2
lines changed

src/Analyzer/Mftf/ActionGroupAnalyzer.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,19 @@ public function analyze(Registry $registryBefore, Registry $registryAfter)
189189
);
190190
}
191191
}
192+
193+
// check new modules
194+
$newModuleEntities = array_diff_key($afterEntities, $beforeEntities);
195+
foreach ($newModuleEntities as $module => $entities) {
196+
$this->findAddedEntitiesInModule(
197+
$beforeEntities[$module] ?? [],
198+
$entities,
199+
self::MFTF_DATA_TYPE,
200+
$this->getReport(),
201+
ActionGroupAdded::class,
202+
$module . '/ActionGroup'
203+
);
204+
}
192205
return $this->getReport();
193206
}
194207
}

src/Analyzer/Mftf/DataAnalyzer.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,19 @@ public function analyze(Registry $registryBefore, Registry $registryAfter)
216216
);
217217
}
218218
}
219+
220+
// check new modules
221+
$newModuleEntities = array_diff_key($afterEntities, $beforeEntities);
222+
foreach ($newModuleEntities as $module => $entities) {
223+
$this->findAddedEntitiesInModule(
224+
$beforeEntities[$module] ?? [],
225+
$entities,
226+
self::MFTF_DATA_TYPE,
227+
$this->getReport(),
228+
DataEntityAdded::class,
229+
$module . '/Data'
230+
);
231+
}
219232
return $this->getReport();
220233
}
221234
}

src/Analyzer/Mftf/MetadataAnalyzer.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function analyze(Registry $registryBefore, Registry $registryAfter)
4040
self::MFTF_DATA_TYPE,
4141
$this->getReport(),
4242
MetadataAdded::class,
43-
$module . '/ActionGroup'
43+
$module . '/Metadata'
4444
);
4545
foreach ($entities as $entityName => $beforeEntity) {
4646
if ($beforeEntity['type'] !== self::MFTF_DATA_TYPE) {
@@ -87,6 +87,19 @@ public function analyze(Registry $registryBefore, Registry $registryAfter)
8787
);
8888
}
8989
}
90+
91+
// check new modules
92+
$newModuleEntities = array_diff_key($afterEntities, $beforeEntities);
93+
foreach ($newModuleEntities as $module => $entities) {
94+
$this->findAddedEntitiesInModule(
95+
$beforeEntities[$module] ?? [],
96+
$entities,
97+
self::MFTF_DATA_TYPE,
98+
$this->getReport(),
99+
MetadataAdded::class,
100+
$module . '/Metadata'
101+
);
102+
}
90103
return $this->getReport();
91104
}
92105

src/Analyzer/Mftf/PageAnalyzer.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,19 @@ public function analyze(Registry $registryBefore, Registry $registryAfter)
9595
);
9696
}
9797
}
98+
99+
// check new modules
100+
$newModuleEntities = array_diff_key($afterEntities, $beforeEntities);
101+
foreach ($newModuleEntities as $module => $entities) {
102+
$this->findAddedEntitiesInModule(
103+
$beforeEntities[$module] ?? [],
104+
$entities ?? [],
105+
self::MFTF_DATA_TYPE,
106+
$this->getReport(),
107+
PageAdded::class,
108+
$module . '/Page'
109+
);
110+
}
98111
return $this->getReport();
99112
}
100113
}

src/Analyzer/Mftf/SectionAnalyzer.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,19 @@ public function analyze(Registry $registryBefore, Registry $registryAfter)
137137
);
138138
}
139139
}
140+
141+
// check new modules
142+
$newModuleEntities = array_diff_key($afterEntities, $beforeEntities);
143+
foreach ($newModuleEntities as $module => $entities) {
144+
$this->findAddedEntitiesInModule(
145+
$beforeEntities[$module] ?? [],
146+
$entities,
147+
self::MFTF_DATA_TYPE,
148+
$this->getReport(),
149+
SectionAdded::class,
150+
$module . '/Section'
151+
);
152+
}
140153
return $this->getReport();
141154
}
142155
}

src/Analyzer/Mftf/SuiteAnalyzer.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,19 @@ public function analyze(Registry $registryBefore, Registry $registryAfter)
154154
);
155155
}
156156
}
157+
158+
// check new modules
159+
$newModuleEntities = array_diff_key($afterEntities, $beforeEntities);
160+
foreach ($newModuleEntities as $module => $entities) {
161+
$this->findAddedEntitiesInModule(
162+
$beforeEntities[$module] ?? [],
163+
$entities,
164+
self::MFTF_DATA_TYPE,
165+
$this->getReport(),
166+
SuiteAdded::class,
167+
$module . '/Suite'
168+
);
169+
}
157170
return $this->getReport();
158171
}
159172

src/Analyzer/Mftf/TestAnalyzer.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,20 @@ public function analyze(Registry $registryBefore, Registry $registryAfter)
172172
);
173173
}
174174
}
175+
176+
// check new modules
177+
$newModuleEntities = array_diff_key($afterEntities, $beforeEntities);
178+
foreach ($newModuleEntities as $module => $entities) {
179+
$this->findAddedEntitiesInModule(
180+
$beforeEntities[$module] ?? [],
181+
$entities,
182+
self::MFTF_DATA_TYPE,
183+
$this->getReport(),
184+
TestAdded::class,
185+
$module . '/Test'
186+
);
187+
188+
}
175189
return $this->getReport();
176190
}
177191

tests/Unit/Console/Command/CompareSourceCommandMftfTest.php

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,15 @@ public function changesDataProvider()
100100
],
101101
'Minor change is detected.'
102102
],
103+
'new-module-actionGroup-added' => [
104+
$pathToFixtures . '/new-module-actionGroup-added/source-code-before',
105+
$pathToFixtures . '/new-module-actionGroup-added/source-code-after',
106+
[
107+
'Mftf (MINOR)',
108+
'ActionGroup/ActionGroup2 | <actionGroup> was added | M225'
109+
],
110+
'Minor change is detected.'
111+
],
103112
'actionGroup-argument-changed' => [
104113
$pathToFixtures . '/actionGroup-argument-changed/source-code-before',
105114
$pathToFixtures . '/actionGroup-argument-changed/source-code-after',
@@ -181,6 +190,15 @@ public function changesDataProvider()
181190
],
182191
'Minor change is detected.'
183192
],
193+
'new-module-data-added' => [
194+
$pathToFixtures . '/new-module-data-added/source-code-before',
195+
$pathToFixtures . '/new-module-data-added/source-code-after',
196+
[
197+
'Mftf (MINOR)',
198+
'Data/DataEntity2 | <entity> was added | M228'
199+
],
200+
'Minor change is detected.'
201+
],
184202
'data-array-removed' => [
185203
$pathToFixtures . '/data-array-removed/source-code-before',
186204
$pathToFixtures . '/data-array-removed/source-code-after',
@@ -276,7 +294,16 @@ public function changesDataProvider()
276294
$pathToFixtures . '/metadata-added/source-code-after',
277295
[
278296
'Mftf (MINOR)',
279-
'ActionGroup/createEntity2 | <operation> was added | M240'
297+
'Metadata/createEntity2 | <operation> was added | M240'
298+
],
299+
'Minor change is detected.'
300+
],
301+
'new-module-metadata-added' => [
302+
$pathToFixtures . '/new-module-metadata-added/source-code-before',
303+
$pathToFixtures . '/new-module-metadata-added/source-code-after',
304+
[
305+
'Mftf (MINOR)',
306+
'Metadata/createEntity2 | <operation> was added | M240'
280307
],
281308
'Minor change is detected.'
282309
],
@@ -379,6 +406,15 @@ public function changesDataProvider()
379406
],
380407
'Minor change is detected.'
381408
],
409+
'new-module-page-added' => [
410+
$pathToFixtures . '/new-module-page-added/source-code-before',
411+
$pathToFixtures . '/new-module-page-added/source-code-after',
412+
[
413+
'Mftf (MINOR)',
414+
'Page/SamplePageNew | <page> was added | M233'
415+
],
416+
'Minor change is detected.'
417+
],
382418
'page-section-removed' => [
383419
$pathToFixtures . '/page-section-removed/source-code-before',
384420
$pathToFixtures . '/page-section-removed/source-code-after',
@@ -415,6 +451,15 @@ public function changesDataProvider()
415451
],
416452
'Minor change is detected.'
417453
],
454+
'new-module-section-added' => [
455+
$pathToFixtures . '/new-module-section-added/source-code-before',
456+
$pathToFixtures . '/new-module-section-added/source-code-after',
457+
[
458+
'Mftf (MINOR)',
459+
'Section/NewSection | <section> was added | M235'
460+
],
461+
'Minor change is detected.'
462+
],
418463
'section-element-removed' => [
419464
$pathToFixtures . '/section-element-removed/source-code-before',
420465
$pathToFixtures . '/section-element-removed/source-code-after',
@@ -487,6 +532,15 @@ public function changesDataProvider()
487532
],
488533
'Minor change is detected.'
489534
],
535+
'new-module-test-added' => [
536+
$pathToFixtures . '/new-module-test-added/source-code-before',
537+
$pathToFixtures . '/new-module-test-added/source-code-after',
538+
[
539+
'Mftf (MINOR)',
540+
'Test/NewTest | <test> was added | M237'
541+
],
542+
'Minor change is detected.'
543+
],
490544
'test-action-changed' => [
491545
$pathToFixtures . '/test-action-changed/source-code-before',
492546
$pathToFixtures . '/test-action-changed/source-code-after',
@@ -640,6 +694,15 @@ public function changesDataProvider()
640694
],
641695
'Minor change is detected.'
642696
],
697+
'new-module-suite-added' => [
698+
$pathToFixtures . '/new-module-suite-added/source-code-before',
699+
$pathToFixtures . '/new-module-suite-added/source-code-after',
700+
[
701+
'Mftf (MINOR)',
702+
'Suite/Sample2Suite | <suite> was added | M407'
703+
],
704+
'Minor change is detected.'
705+
],
643706
'suite-removed' => [
644707
$pathToFixtures . '/suite-removed/source-code-before',
645708
$pathToFixtures . '/suite-removed/source-code-after',
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="ActionGroup1">
11+
<comment userInput="action1" stepKey="action1"/>
12+
<comment userInput="action2" stepKey="action2"/>
13+
</actionGroup>
14+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="ActionGroup2">
11+
<comment userInput="action1" stepKey="action1"/>
12+
<comment userInput="action2" stepKey="action2"/>
13+
</actionGroup>
14+
</actionGroups>

0 commit comments

Comments
 (0)