Skip to content

Commit e3ecfb8

Browse files
committed
MC-17627: Dependency static test does not analyze content of phtml files
- Fixed codestyle
1 parent 4e252de commit e3ecfb8

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

dev/tests/static/framework/Magento/TestFramework/Dependency/PhpRule.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ private function isPluginDependency($dependent, $dependency)
290290
protected function _caseGetUrl(string $currentModule, string &$contents): array
291291
{
292292
$pattern = '#(\->|:)(?<source>getUrl\(([\'"])(?<route_id>[a-z0-9\-_]{3,}|\*)'
293-
.'(\/(?<controller_name>[a-z0-9\-_]+|\*))?(\/(?<action_name>[a-z0-9\-_]+|\*))?\3)#i';
293+
.'(/(?<controller_name>[a-z0-9\-_]+|\*))?(/(?<action_name>[a-z0-9\-_]+|\*))?\3)#i';
294294

295295
$dependencies = [];
296296
if (!preg_match_all($pattern, $contents, $matches, PREG_SET_ORDER)) {
@@ -304,11 +304,11 @@ protected function _caseGetUrl(string $currentModule, string &$contents): array
304304
$actionName = $item['action_name'] ?? UrlInterface::DEFAULT_ACTION_NAME;
305305

306306
// skip rest
307-
if ($routeId === "rest") { //MC-17627
307+
if ($routeId === "rest") { //MC-19890
308308
continue;
309309
}
310310
// skip wildcards
311-
if ($routeId === "*" || $controllerName === "*" || $actionName === "*") { //MC-17627
311+
if ($routeId === "*" || $controllerName === "*" || $actionName === "*") { //MC-19890
312312
continue;
313313
}
314314
$modules = $this->routeMapper->getDependencyByRoutePath(

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -265,14 +265,12 @@ private static function getRoutesWhitelist(): array
265265
{
266266
if (is_null(self::$routesWhitelist)) {
267267
$routesWhitelistFilePattern = realpath(__DIR__) . '/_files/dependency_test/whitelist/routes_*.php';
268-
self::$routesWhitelist = [];
268+
$routesWhitelist = [];
269269
foreach (glob($routesWhitelistFilePattern) as $fileName) {
270270
//phpcs:ignore Magento2.Performance.ForeachArrayMerge
271-
self::$routesWhitelist = array_merge(
272-
self::$routesWhitelist,
273-
include $fileName
274-
);
271+
$routesWhitelist = array_merge($routesWhitelist, include $fileName);
275272
}
273+
self::$routesWhitelist = $routesWhitelist;
276274
}
277275
return self::$routesWhitelist;
278276
}

0 commit comments

Comments
 (0)