Skip to content

Commit c3295e0

Browse files
committed
MC-31618: Move static config to files - PLUGIN_LIST
- Fix static tests;
1 parent 90bcfb3 commit c3295e0

File tree

2 files changed

+10
-30
lines changed

2 files changed

+10
-30
lines changed

lib/internal/Magento/Framework/Interception/ConfigWriter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public function write($scopes)
174174
foreach ($virtualTypes as $class) {
175175
$this->inheritPlugins($class, $this->pluginData, $this->inherited, $this->processed);
176176
}
177-
foreach ($this->pluginData as $className => $value) {
177+
foreach (array_keys($this->pluginData) as $className) {
178178
$this->inheritPlugins($className, $this->pluginData, $this->inherited, $this->processed);
179179
}
180180
foreach ($this->getClassDefinitions() as $class) {

lib/internal/Magento/Framework/Interception/Test/Unit/PluginList/PluginListTest.php

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,7 @@ protected function setUp(): void
130130

131131
public function testGetPlugin()
132132
{
133-
$inheritPlugins = function ($type)
134-
{
133+
$inheritPlugins = function ($type) {
135134
$inheritedItem = [
136135
Item::class => [
137136
'advanced_plugin' => [
@@ -147,17 +146,12 @@ public function testGetPlugin()
147146
$processedItem = [
148147
'Magento\Framework\Interception\Test\Unit\Custom\Module\Model\Item_getName___self' => [
149148
2 => 'advanced_plugin',
150-
4 => [
151-
'advanced_plugin'
152-
]
149+
4 => ['advanced_plugin']
153150
],
154151
'Magento\Framework\Interception\Test\Unit\Custom\Module\Model\Item_getName_advanced_plugin' => [
155-
4 => [
156-
'simple_plugin'
157-
]
152+
4 => ['simple_plugin']
158153
]
159154
];
160-
161155
$inheritedItemContainer = [
162156
ItemContainer::class => [
163157
'simple_plugin' => [
@@ -168,12 +162,9 @@ public function testGetPlugin()
168162
];
169163
$processedItemContainer = [
170164
'Magento\Framework\Interception\Test\Unit\Custom\Module\Model\ItemContainer_getName___self' => [
171-
4 => [
172-
'simple_plugin'
173-
]
165+
4 => ['simple_plugin']
174166
]
175167
];
176-
177168
$inheritedStartingBackslash = [
178169
StartingBackslash::class => [
179170
'simple_plugin' => [
@@ -187,12 +178,10 @@ public function testGetPlugin()
187178
$this->_inherited = $inheritedItem;
188179
$this->_processed = $processedItem;
189180
}
190-
191181
if ($type === 'Magento\Framework\Interception\Test\Unit\Custom\Module\Model\ItemContainer') {
192182
$this->_inherited = array_merge($inheritedItem, $inheritedItemContainer);
193183
$this->_processed = array_merge($processedItem, $processedItemContainer);
194184
}
195-
196185
if ($type === 'Magento\Framework\Interception\Test\Unit\Custom\Module\Model\StartingBackslash') {
197186
$this->_inherited = array_merge($inheritedItem, $inheritedItemContainer, $inheritedStartingBackslash);
198187
$this->_processed = array_merge($processedItem, $processedItemContainer);
@@ -203,14 +192,8 @@ public function testGetPlugin()
203192

204193
$this->configScopeMock->method('getCurrentScope')->willReturn('backend');
205194
$this->object->getNext(Item::class, 'getName');
206-
$this->object->getNext(
207-
ItemContainer::class,
208-
'getName'
209-
);
210-
$this->object->getNext(
211-
StartingBackslash::class,
212-
'getName'
213-
);
195+
$this->object->getNext(ItemContainer::class, 'getName');
196+
$this->object->getNext(StartingBackslash::class, 'getName');
214197
$this->assertEquals(
215198
Simple::class,
216199
$this->object->getPlugin(
@@ -261,8 +244,7 @@ public function testGetPlugins(
261244
$this->setScopePriorityScheme($scopePriorityScheme);
262245
$this->configScopeMock->method('getCurrentScope')->willReturn($scopeCode);
263246

264-
$inheritPlugins = function ($type)
265-
{
247+
$inheritPlugins = function ($type) {
266248
$inheritedItem = [
267249
Item::class => [
268250
'simple_plugin' => [
@@ -327,8 +309,7 @@ public function testLoadScopedDataCached()
327309
->with('global|scope|interception')
328310
->willReturn($serializedData);
329311

330-
$inheritPlugins = function ($type)
331-
{
312+
$inheritPlugins = function ($type) {
332313
$inherited = [
333314
0 => 'key',
334315
'Type' => null
@@ -365,8 +346,7 @@ public function testLoadScopedDataGenerated()
365346
->with('global|scope|interception')
366347
->willReturn($data);
367348

368-
$inheritPlugins = function ($type)
369-
{
349+
$inheritPlugins = function ($type) {
370350
$inherited = [
371351
0 => 'key',
372352
'Type' => null

0 commit comments

Comments
 (0)