17 $mapRoutes = [
'someModule' => [
'Magento\SomeModule'],
'anotherModule' => [
'Magento\OneModule']];
18 $mapLayoutBlocks = [
'area' => [
'block.name' => [
'Magento\SomeModule' =>
'Magento\SomeModule']]];
20 'Magento\Module1\Plugin1' =>
'Magento\Module1\Subject',
21 'Magento\Module1\Plugin2' =>
'Magento\Module2\Subject',
23 $this->model =
new PhpRule($mapRoutes, $mapLayoutBlocks, $pluginMap);
29 $this->assertEmpty($this->model->getDependencyInfo(
'any',
'not php',
'any',
$content));
40 $file = $this->makeMockFilepath(
$class);
41 $module = $this->getModuleFromClass(
$class);
42 $this->assertEquals($expected, $this->model->getDependencyInfo($module,
'php', $file,
$content));
51 'Extend class in same module' => [
52 'Magento\SomeModule\SomeClass',
53 'something extends \Magento\SomeModule\Any\ClassName {',
56 'Extend class in different module' => [
57 'Magento\AnotherModule\SomeClass',
58 'something extends \Magento\SomeModule\Any\ClassName {',
61 'module' =>
'Magento\SomeModule',
63 'source' =>
'Magento\SomeModule\Any\ClassName',
67 'getViewFileUrl in same module' => [
68 'Magento\SomeModule\SomeClass',
69 '$this->getViewFileUrl("Magento_SomeModule::js/order-by-sku-failure.js")',
72 'getViewFileUrl in different module' => [
73 'Magento\AnotherModule\SomeClass',
74 '$this->getViewFileUrl("Magento_SomeModule::js/order-by-sku-failure.js")',
77 'module' =>
'Magento\SomeModule',
79 'source' =>
'Magento_SomeModule',
83 'Helper class from same module' => [
84 'Magento\SomeModule\SomeClass',
85 '$this->helper("Magento\SomeModule\Any\ClassName")',
88 'Helper class from another module' => [
89 'Magento\AnotherModule\SomeClass',
90 '$this->helper("Magento\SomeModule\Any\ClassName")',
93 'module' =>
'Magento\SomeModule',
95 'source' =>
'Magento\SomeModule\Any\ClassName',
99 'getUrl from same module' => [
100 'Magento\SomeModule\SomeClass',
101 '$this->getUrl("someModule")',
104 'getUrl from another module' => [
105 'Magento\SomeModule\SomeClass',
106 '$this->getUrl("anotherModule")',
109 'module' =>
'Magento\OneModule',
111 'source' =>
'getUrl("anotherModule"',
115 'getBlock from same module' => [
116 'Magento\SomeModule\SomeClass',
117 '$this->getLayout()->getBlock(\'block.name\');', []
119 'getBlock from another module' => [
120 'Magento\AnotherModule\SomeClass',
121 '$this->getLayout()->getBlock(\'block.name\');',
124 'module' =>
'Magento\SomeModule',
126 'source' =>
'getBlock(\'block.name\')',
130 'Plugin on class in same module' => [
131 'Magento\Module1\Plugin1',
132 ', \Magento\Module1\Subject $variable',
135 'Plugin depends on arbitrary class in same module' => [
136 'Magento\Module1\Plugin1',
137 ', \Magento\Module1\NotSubject $variable',
140 'Plugin on class in different module' => [
141 'Magento\Module1\Plugin2',
142 'Magento\Module2\Subject',
145 'module' =>
'Magento\Module2',
147 'source' =>
'Magento\Module2\Subject',
151 'Plugin depends on arbitrary class in same module as subject' => [
152 'Magento\Module1\Plugin2',
153 'Magento\Module2\NotSubject',
156 'module' =>
'Magento\Module2',
158 'source' =>
'Magento\Module2\NotSubject',
162 'Plugin depends on arbitrary class in arbitrary module' => [
163 'Magento\Module1\Plugin2',
164 'Magento\OtherModule\NotSubject',
167 'module' =>
'Magento\OtherModule',
169 'source' =>
'Magento\OtherModule\NotSubject',
187 'Magento\SomeModule' =>
'Magento\SomeModule',
191 $this->model =
new PhpRule([], $mapLayoutBlocks);
192 $this->assertEquals($expected, $this->model->getDependencyInfo($module,
'template',
'any',
$content));
199 'Magento\AnotherModule',
200 '$this->getLayout()->getBlock(\'block.name\');',
203 'module' =>
'Magento\SomeModule',
205 'source' =>
'getBlock(\'block.name\')',
218 private function makeMockFilepath(
$class)
220 return 'ClassRoot' . DIRECTORY_SEPARATOR . str_replace(
'\\', DIRECTORY_SEPARATOR,
$class) .
'.php';
230 private function getModuleFromClass(
$class)
getDefaultModelDependencyDataProvider()
testGetDefaultModelDependency($module, $content, array $expected)
testNonPhpGetDependencyInfo()
$_option $_optionId $class
testGetDependencyInfo($class, $content, array $expected)
getDependencyInfoDataProvider()