Skip to content

Commit cba0c4e

Browse files
committed
MC-40791: Add a static test to prevent creating new legacy fixture files
1 parent 921ff74 commit cba0c4e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

dev/tests/static/testsuite/Magento/Test/Legacy/LegacyFixtureTest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,15 @@ public function testNew(): void
2727
$legacyFixtureFiles = [];
2828
foreach ($files as $file) {
2929
if (pathinfo($file, PATHINFO_EXTENSION) === 'php'
30-
&& preg_match('/(Test|integration\/testsuite|api-functional\/testsuite).*\/(_files|Fixtures)/', $file)
30+
&& (
31+
preg_match('/(integration\/testsuite|api-functional\/testsuite).*\/(_files|Fixtures)/', $file)
32+
// Cover the case when tests are located in the module folder instead of dev/tests.
33+
// for instance inventory
34+
|| (
35+
strpos($file, 'dev/tests/') === false
36+
&& preg_match('/app\/code\/.*\/Test.*\/(_files|Fixtures)/', $file)
37+
)
38+
)
3139
) {
3240
$legacyFixtureFiles[] = str_replace(BP . '/', '', $file);
3341
}

0 commit comments

Comments
 (0)