Skip to content

Commit f3d785c

Browse files
committed
MAGETWO-58386: Eliminate dependencies on modules from lib/Magento.
1 parent 01e0ef8 commit f3d785c

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

dev/tests/static/testsuite/Magento/Test/Integrity/Library/DependencyTest.php

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class DependencyTest extends \PHPUnit_Framework_TestCase
2727
protected $errors = [];
2828

2929
/**
30-
* Forbidden base namespaces
30+
* Allowed sub namespaces
3131
*
3232
* @return array
3333
*/
@@ -37,15 +37,22 @@ protected function getAllowedNamespaces()
3737
'Framework',
3838
'SomeModule',
3939
'ModuleName',
40-
'Setup',
41-
'Store',
42-
'Directory',
43-
'PageCache',
44-
'Backup',
45-
'Backend',
46-
'Ui',
47-
'SalesRule',
48-
'Theme'
40+
'Setup\Console\CommandList',
41+
'Setup\Console\CompilerPreparation',
42+
'Setup\Model\ObjectManagerProvider',
43+
'Setup\Mvc\Bootstrap\InitParamListener',
44+
'Store\Model\ScopeInterface',
45+
'Store\Model\StoreManagerInterface',
46+
'Directory\Model\CurrencyFactory',
47+
'PageCache\Model\Cache\Type',
48+
'Backup\Model\ResourceModel\Db',
49+
'Backend\Block\Widget\Button',
50+
'Ui\Component\Container',
51+
'SalesRule\Model\Rule',
52+
'SalesRule\Api\Data\RuleInterface',
53+
'SalesRule\Model\Rule\Interceptor',
54+
'SalesRule\Model\Rule\Proxy',
55+
'Theme\Model\View\Design'
4956
];
5057
}
5158

@@ -66,7 +73,8 @@ function ($file) {
6673
(new Injectable())->getDependencies($fileReflection),
6774
$tokens->getDependencies()
6875
);
69-
$pattern = '#Magento\\\\(?!' . implode('|', $this->getAllowedNamespaces()) . ').*#';
76+
$allowedNamespaces = str_replace('\\','\\\\', implode('|', $this->getAllowedNamespaces()));
77+
$pattern = '#Magento\\\\(?!' . $allowedNamespaces . ').*#';
7078
foreach ($dependencies as $dependency) {
7179
$dependencyPaths = explode('\\', $dependency);
7280
$dependencyPaths = array_slice($dependencyPaths, 2);

0 commit comments

Comments
 (0)