Skip to content

Commit d3ae207

Browse files
committed
DEVOPS-2346: Fix static tests
1 parent 51fa02a commit d3ae207

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ class CompilerTest extends \PHPUnit\Framework\TestCase
6262
*/
6363
protected $pluginValidator;
6464

65+
/**
66+
* @var string[]|null
67+
*/
68+
private $pluginBlacklist;
69+
6570
protected function setUp()
6671
{
6772
$this->_shell = new \Magento\Framework\Shell(new \Magento\Framework\Shell\CommandRenderer());
@@ -107,6 +112,31 @@ protected function setUp()
107112
$this->pluginValidator = new PluginValidator(new InterfaceValidator());
108113
}
109114

115+
/**
116+
* Return plugin blacklist class names
117+
*
118+
* @return string[]
119+
*/
120+
private function getPluginBlacklist(): array
121+
{
122+
if ($this->pluginBlacklist === null) {
123+
$blacklistFiles = str_replace(
124+
'\\',
125+
'/',
126+
realpath(__DIR__) . '/../_files/blacklist/compiler_plugins*.txt'
127+
);
128+
$blacklistItems = [];
129+
foreach (glob($blacklistFiles) as $fileName) {
130+
$blacklistItems = array_merge(
131+
$blacklistItems,
132+
file($fileName, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES)
133+
);
134+
}
135+
$this->pluginBlacklist = $blacklistItems;
136+
}
137+
return $this->pluginBlacklist;
138+
}
139+
110140
/**
111141
* Validate DI config file
112142
*
@@ -360,6 +390,7 @@ protected function validatePlugins($plugin, $type)
360390
* Get application plugins
361391
*
362392
* @return array
393+
* @throws \Exception
363394
*/
364395
protected function pluginDataProvider()
365396
{
@@ -376,8 +407,10 @@ protected function pluginDataProvider()
376407
$type = \Magento\Framework\App\Utility\Classes::resolveVirtualType($type);
377408
if ($node->attributes->getNamedItem('type')) {
378409
$plugin = $node->attributes->getNamedItem('type')->nodeValue;
379-
$plugin = \Magento\Framework\App\Utility\Classes::resolveVirtualType($plugin);
380-
$plugins[] = ['plugin' => $plugin, 'intercepted type' => $type];
410+
if (!in_array($plugin, $this->getPluginBlacklist())) {
411+
$plugin = \Magento\Framework\App\Utility\Classes::resolveVirtualType($plugin);
412+
$plugins[] = ['plugin' => $plugin, 'intercepted type' => $type];
413+
}
381414
}
382415
}
383416
}

0 commit comments

Comments
 (0)