Skip to content

Commit 90e2924

Browse files
committed
ECP-530: Static test to detect external project dependencies
1 parent 694f15b commit 90e2924

File tree

4 files changed

+30
-30
lines changed

4 files changed

+30
-30
lines changed

dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/DbRuleTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function getDependencyInfoDataProvider()
3737
'any',
3838
'/app/some/path/Setup/some-file.php',
3939
'$install->getTableName("unknown_table")',
40-
[['module' => 'Unknown', 'source' => 'unknown_table']]
40+
[['modules' => ['Unknown'], 'source' => 'unknown_table']]
4141
],
4242
[
4343
'SomeModule',
@@ -51,7 +51,7 @@ public function getDependencyInfoDataProvider()
5151
'$install->getTableName("some_table")',
5252
[
5353
[
54-
'module' => 'SomeModule',
54+
'modules' => ['SomeModule'],
5555
'type' => \Magento\TestFramework\Dependency\RuleInterface::TYPE_HARD,
5656
'source' => 'some_table',
5757
]

dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/DiRuleTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,32 +48,32 @@ public function getDependencyInfoDataProvider()
4848
$this->getFileContent('di_external_dependency.xml'),
4949
[
5050
[
51-
'module' => 'Magento\ExternalModule3',
51+
'modules' => ['Magento\ExternalModule3'],
5252
'type' => RuleInterface::TYPE_SOFT,
5353
'source' => 'Magento\ExternalModule3\Some\Another\Class'
5454
],
5555
[
56-
'module' => 'Magento\ExternalModule5',
56+
'modules' => ['Magento\ExternalModule5'],
5757
'type' => RuleInterface::TYPE_SOFT,
5858
'source' => 'Magento\ExternalModule5\Some\Another\Class'
5959
],
6060
[
61-
'module' => 'Magento\ExternalModule6',
61+
'modules' => ['Magento\ExternalModule6'],
6262
'type' => RuleInterface::TYPE_SOFT,
6363
'source' => 'Magento\ExternalModule6\Some\Plugin\Class'
6464
],
6565
[
66-
'module' => 'Magento\ExternalModule1',
66+
'modules' => ['Magento\ExternalModule1'],
6767
'type' => RuleInterface::TYPE_HARD,
6868
'source' => 'Magento\ExternalModule1\Some\Argument1'
6969
],
7070
[
71-
'module' => 'Magento\ExternalModule2',
71+
'modules' => ['Magento\ExternalModule2'],
7272
'type' => RuleInterface::TYPE_HARD,
7373
'source' => 'Magento\ExternalModule2\Some\Argument2'
7474
],
7575
[
76-
'module' => 'Magento\ExternalModule4',
76+
'modules' => ['Magento\ExternalModule4'],
7777
'type' => RuleInterface::TYPE_HARD,
7878
'source' => 'Magento\ExternalModule4\Some\Argument3'
7979
]
@@ -84,12 +84,12 @@ public function getDependencyInfoDataProvider()
8484
$this->getFileContent('di_virtual_dependency.xml'),
8585
[
8686
[
87-
'module' => 'Magento\AnotherModule',
87+
'modules' => ['Magento\AnotherModule'],
8888
'type' => RuleInterface::TYPE_HARD,
8989
'source' => 'Magento\AnotherModule\Some\Class1',
9090
],
9191
[
92-
'module' => 'Magento\AnotherModule',
92+
'modules' => ['Magento\AnotherModule'],
9393
'type' => RuleInterface::TYPE_HARD,
9494
'source' => 'Magento\AnotherModule\Some\Class2',
9595
]

dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/LayoutRuleTest.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function getDependencyInfoDataProvider()
3232
'<element module="Magento\AnotherModule"/>',
3333
[
3434
[
35-
'module' => 'Magento\AnotherModule',
35+
'modules' => ['Magento\AnotherModule'],
3636
'type' => \Magento\Test\Integrity\DependencyTest::TYPE_SOFT,
3737
'source' => '<element module="Magento\AnotherModule"/>',
3838
]
@@ -43,7 +43,7 @@ public function getDependencyInfoDataProvider()
4343
'<block class="Magento\AnotherModule\Several\Chunks"/>',
4444
[
4545
[
46-
'module' => 'Magento\AnotherModule',
46+
'modules' => ['Magento\AnotherModule'],
4747
'type' => \Magento\Test\Integrity\DependencyTest::TYPE_HARD,
4848
'source' => '<block class="Magento\AnotherModule\Several\Chunks"/>',
4949
]
@@ -56,7 +56,7 @@ public function getDependencyInfoDataProvider()
5656
</any>',
5757
[
5858
[
59-
'module' => 'Magento\AnotherModule',
59+
'modules' => ['Magento\AnotherModule'],
6060
'type' => \Magento\Test\Integrity\DependencyTest::TYPE_SOFT,
6161
'source' => '<block template="Magento_AnotherModule::template/path.phtml"/>',
6262
]
@@ -67,7 +67,7 @@ public function getDependencyInfoDataProvider()
6767
'<block>Magento\AnotherModule\Several\Chunks</block>',
6868
[
6969
[
70-
'module' => 'Magento\AnotherModule',
70+
'modules' => ['Magento\AnotherModule'],
7171
'type' => \Magento\Test\Integrity\DependencyTest::TYPE_SOFT,
7272
'source' => '<block>Magento\AnotherModule\Several\Chunks</block>',
7373
]
@@ -78,7 +78,7 @@ public function getDependencyInfoDataProvider()
7878
'<template>Magento_AnotherModule::template/path.phtml</template>',
7979
[
8080
[
81-
'module' => 'Magento\AnotherModule',
81+
'modules' => ['Magento\AnotherModule'],
8282
'type' => \Magento\Test\Integrity\DependencyTest::TYPE_SOFT,
8383
'source' => '<template>Magento_AnotherModule::template/path.phtml</template>',
8484
]
@@ -89,7 +89,7 @@ public function getDependencyInfoDataProvider()
8989
'<file>Magento_AnotherModule::file/path.txt</file>',
9090
[
9191
[
92-
'module' => 'Magento\AnotherModule',
92+
'modules' => ['Magento\AnotherModule'],
9393
'type' => \Magento\Test\Integrity\DependencyTest::TYPE_SOFT,
9494
'source' => '<file>Magento_AnotherModule::file/path.txt</file>',
9595
]
@@ -100,7 +100,7 @@ public function getDependencyInfoDataProvider()
100100
'<any helper="Magento\AnotherModule\Several\Chunks::text"/>',
101101
[
102102
[
103-
'module' => 'Magento\AnotherModule',
103+
'modules' => ['Magento\AnotherModule'],
104104
'type' => \Magento\Test\Integrity\DependencyTest::TYPE_SOFT,
105105
'source' => '<any helper="Magento\AnotherModule\Several\Chunks::text"/>',
106106
]
@@ -120,7 +120,7 @@ public function testUpdatesRouterGetDependencyInfo($contents, $type)
120120
$model = new LayoutRule(['router_name' => ['Magento\RouterModule']], [], []);
121121
$this->assertEquals([], $model->getDependencyInfo('Magento\RouterModule', 'layout', 'any', $contents));
122122
$this->assertEquals(
123-
[['module' => 'Magento\RouterModule', 'type' => $type, 'source' => 'router_name_action']],
123+
[['modules' => ['Magento\RouterModule'], 'type' => $type, 'source' => 'router_name_action']],
124124
$model->getDependencyInfo('Magento\AnotherModule', 'layout', 'any', $contents)
125125
);
126126
}
@@ -148,11 +148,11 @@ public function testLayoutGetDependencyInfo($contents, $type, $isHandle)
148148
$model->getDependencyInfo('Magento\DefaultHandleModule', 'layout', 'any', $contents)
149149
);
150150
$this->assertEquals(
151-
[['module' => 'Magento\DefaultHandleModule', 'type' => $type, 'source' => 'singlechunk']],
151+
[['modules' => ['Magento\DefaultHandleModule'], 'type' => $type, 'source' => 'singlechunk']],
152152
$model->getDependencyInfo('any', 'layout', 'any', $contents)
153153
);
154154
$this->assertEquals(
155-
[['module' => 'Magento\AnyHandleModule', 'type' => $type, 'source' => 'any_handle_name']],
155+
[['modules' => ['Magento\AnyHandleModule'], 'type' => $type, 'source' => 'any_handle_name']],
156156
$model->getDependencyInfo('any', 'layout', 'path/frontend/file.txt', $contents)
157157
);
158158
// test several modules
@@ -166,7 +166,7 @@ public function testLayoutGetDependencyInfo($contents, $type, $isHandle)
166166
];
167167
$model = $isHandle ? new LayoutRule([], [], $data) : new LayoutRule([], $data, []);
168168
$this->assertEquals(
169-
[['module' => 'Magento\Theme', 'type' => $type, 'source' => 'any_handle_name']],
169+
[['modules' => ['Magento\Theme'], 'type' => $type, 'source' => 'any_handle_name']],
170170
$model->getDependencyInfo('any', 'layout', 'path/frontend/file.txt', $contents)
171171
);
172172
$this->assertEquals(

dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/PhpRuleTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function getDependencyInfoDataProvider()
8989
'something extends \Magento\SomeModule\Any\ClassName {',
9090
[
9191
[
92-
'module' => 'Magento\SomeModule',
92+
'modules' => ['Magento\SomeModule'],
9393
'type' => \Magento\TestFramework\Dependency\RuleInterface::TYPE_HARD,
9494
'source' => 'Magento\SomeModule\Any\ClassName',
9595
]
@@ -105,7 +105,7 @@ public function getDependencyInfoDataProvider()
105105
'$this->getViewFileUrl("Magento_SomeModule::js/order-by-sku-failure.js")',
106106
[
107107
[
108-
'module' => 'Magento\SomeModule',
108+
'modules' => ['Magento\SomeModule'],
109109
'type' => \Magento\TestFramework\Dependency\RuleInterface::TYPE_HARD,
110110
'source' => 'Magento_SomeModule',
111111
]
@@ -121,7 +121,7 @@ public function getDependencyInfoDataProvider()
121121
'$this->helper("Magento\SomeModule\Any\ClassName")',
122122
[
123123
[
124-
'module' => 'Magento\SomeModule',
124+
'modules' => ['Magento\SomeModule'],
125125
'type' => \Magento\TestFramework\Dependency\RuleInterface::TYPE_HARD,
126126
'source' => 'Magento\SomeModule\Any\ClassName',
127127
]
@@ -136,7 +136,7 @@ public function getDependencyInfoDataProvider()
136136
'$this->getLayout()->getBlock(\'block.name\');',
137137
[
138138
[
139-
'module' => 'Magento\SomeModule',
139+
'modules' => ['Magento\SomeModule'],
140140
'type' => \Magento\TestFramework\Dependency\RuleInterface::TYPE_HARD,
141141
'source' => 'getBlock(\'block.name\')',
142142
]
@@ -157,7 +157,7 @@ public function getDependencyInfoDataProvider()
157157
'Magento\Module2\Subject',
158158
[
159159
[
160-
'module' => 'Magento\Module2',
160+
'modules' => ['Magento\Module2'],
161161
'type' => \Magento\TestFramework\Dependency\RuleInterface::TYPE_SOFT,
162162
'source' => 'Magento\Module2\Subject',
163163
]
@@ -168,7 +168,7 @@ public function getDependencyInfoDataProvider()
168168
'Magento\Module2\NotSubject',
169169
[
170170
[
171-
'module' => 'Magento\Module2',
171+
'modules' => ['Magento\Module2'],
172172
'type' => \Magento\TestFramework\Dependency\RuleInterface::TYPE_SOFT,
173173
'source' => 'Magento\Module2\NotSubject',
174174
]
@@ -179,7 +179,7 @@ public function getDependencyInfoDataProvider()
179179
'Magento\OtherModule\NotSubject',
180180
[
181181
[
182-
'module' => 'Magento\OtherModule',
182+
'modules' => ['Magento\OtherModule'],
183183
'type' => \Magento\TestFramework\Dependency\RuleInterface::TYPE_HARD,
184184
'source' => 'Magento\OtherModule\NotSubject',
185185
]
@@ -222,7 +222,7 @@ public function getDependencyInfoDataCaseGetUrlDataProvider()
222222
'$this->getUrl("cms/index/index")',
223223
[
224224
[
225-
'module' => 'Magento\Cms',
225+
'modules' => ['Magento\Cms'],
226226
'type' => \Magento\TestFramework\Dependency\RuleInterface::TYPE_HARD,
227227
'source' => 'getUrl("cms/index/index"',
228228
]
@@ -295,7 +295,7 @@ public function getDefaultModelDependencyDataProvider()
295295
'$this->getLayout()->getBlock(\'block.name\');',
296296
[
297297
[
298-
'module' => 'Magento\SomeModule',
298+
'modules' => ['Magento\SomeModule'],
299299
'type' => \Magento\TestFramework\Dependency\RuleInterface::TYPE_HARD,
300300
'source' => 'getBlock(\'block.name\')',
301301
]

0 commit comments

Comments
 (0)