Skip to content

Commit 6085e89

Browse files
committed
MC-31618: Move static config to files - PLUGIN_LIST
- Fix integration tests;
1 parent 7db4ca1 commit 6085e89

File tree

7 files changed

+44
-17
lines changed

7 files changed

+44
-17
lines changed

dev/tests/integration/framework/Magento/TestFramework/Interception/PluginList.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\TestFramework\Interception;
77

8+
use Magento\Framework\Interception\ConfigLoaderInterface;
9+
use Magento\Framework\Interception\ConfigWriterInterface;
810
use Magento\Framework\Serialize\SerializerInterface;
911

1012
/**
@@ -31,6 +33,8 @@ class PluginList extends \Magento\Framework\Interception\PluginList\PluginList
3133
* @param array $scopePriorityScheme
3234
* @param string|null $cacheId
3335
* @param SerializerInterface|null $serializer
36+
* @param ConfigLoaderInterface|null $configLoader
37+
* @param ConfigWriterInterface|null $configWriter
3438
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
3539
*/
3640
public function __construct(
@@ -44,7 +48,9 @@ public function __construct(
4448
\Magento\Framework\ObjectManager\DefinitionInterface $classDefinitions,
4549
array $scopePriorityScheme,
4650
$cacheId = 'plugins',
47-
SerializerInterface $serializer = null
51+
SerializerInterface $serializer = null,
52+
ConfigLoaderInterface $configLoader = null,
53+
ConfigWriterInterface $configWriter = null
4854
) {
4955
parent::__construct(
5056
$reader,
@@ -57,7 +63,9 @@ public function __construct(
5763
$classDefinitions,
5864
$scopePriorityScheme,
5965
$cacheId,
60-
$serializer
66+
$serializer,
67+
$configLoader,
68+
$configWriter
6169
);
6270
$this->_originScopeScheme = $this->_scopePriorityScheme;
6371
}

dev/tests/integration/testsuite/Magento/Framework/Interception/AbstractPlugin.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\Framework\Interception;
77

8+
use Magento\Framework\App\Filesystem\DirectoryList;
9+
810
/**
911
* Class GeneralTest
1012
*
@@ -81,6 +83,10 @@ public function setUpInterceptionConfig($pluginConfig)
8183
$cacheManager->method('load')->willReturn(null);
8284
$definitions = new \Magento\Framework\ObjectManager\Definition\Runtime();
8385
$relations = new \Magento\Framework\ObjectManager\Relations\Runtime();
86+
$dirList = new DirectoryList(DirectoryList::GENERATED_METADATA);
87+
$configLoader = new \Magento\Framework\Interception\ConfigLoader($dirList);
88+
$logger = $this->createMock(\Psr\Log\LoggerInterface::class);
89+
$configWriter = $this->createMock(\Magento\Framework\App\ObjectManager\ConfigWriterInterface::class);
8490
$interceptionConfig = new Config\Config(
8591
$this->_configReader,
8692
$configScope,
@@ -104,6 +110,9 @@ public function setUpInterceptionConfig($pluginConfig)
104110
\Magento\Framework\ObjectManager\DefinitionInterface::class => $definitions,
105111
\Magento\Framework\Interception\DefinitionInterface::class => $interceptionDefinitions,
106112
\Magento\Framework\Serialize\SerializerInterface::class => $json,
113+
\Magento\Framework\Interception\ConfigLoaderInterface::class => $configLoader,
114+
\Psr\Log\LoggerInterface::class => $logger,
115+
\Magento\Framework\App\ObjectManager\ConfigWriterInterface::class => $configWriter
107116
];
108117
$this->_objectManager = new \Magento\Framework\ObjectManager\ObjectManager(
109118
$factory,
@@ -120,6 +129,8 @@ public function setUpInterceptionConfig($pluginConfig)
120129
\Magento\Framework\Interception\PluginList\PluginList::class,
121130
\Magento\Framework\Interception\ChainInterface::class =>
122131
\Magento\Framework\Interception\Chain\Chain::class,
132+
\Magento\Framework\Interception\ConfigWriterInterface::class =>
133+
\Magento\Framework\Interception\ConfigWriter::class
123134
],
124135
]
125136
);

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ public function __construct(
2525
}
2626

2727
/**
28-
* @inheritDoc
28+
* Load interception configuration data per scope.
29+
*
30+
* @param string $cacheId
31+
* @return array
32+
* @throws \Magento\Framework\Exception\FileSystemException
2933
*/
3034
public function load($cacheId)
3135
{

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,10 @@ public function __construct(
143143
}
144144

145145
/**
146-
* @inheritDoc
146+
* Write interception configuration for scopes.
147+
*
148+
* @param array $scopes
149+
* @return void
147150
*/
148151
public function write($scopes)
149152
{

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ interface ConfigWriterInterface
1414
* Write interception configuration for scopes.
1515
*
1616
* @param array $scopes
17-
* @return array
17+
* @return void
1818
*/
1919
public function write($scopes);
2020
}

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
use Magento\Framework\Config\Data\Scoped;
1010
use Magento\Framework\Config\ReaderInterface;
1111
use Magento\Framework\Config\ScopeInterface;
12+
use Magento\Framework\Interception\ConfigLoaderInterface;
13+
use Magento\Framework\Interception\ConfigWriterInterface;
1214
use Magento\Framework\Interception\DefinitionInterface;
1315
use Magento\Framework\Interception\PluginListInterface as InterceptionPluginList;
1416
use Magento\Framework\Interception\ObjectManager\ConfigInterface;
@@ -17,8 +19,6 @@
1719
use Magento\Framework\ObjectManagerInterface;
1820
use Magento\Framework\Serialize\SerializerInterface;
1921
use Magento\Framework\Serialize\Serializer\Serialize;
20-
use Magento\Framework\Interception\ConfigLoader;
21-
use Magento\Framework\Interception\ConfigWriter;
2222

2323
/**
2424
* Plugin config, provides list of plugins for a type
@@ -83,12 +83,12 @@ class PluginList extends Scoped implements InterceptionPluginList
8383
private $serializer;
8484

8585
/**
86-
* @var ConfigLoader
86+
* @var ConfigLoaderInterface
8787
*/
8888
private $configLoader;
8989

9090
/**
91-
* @var ConfigWriter
91+
* @var ConfigWriterInterface
9292
*/
9393
private $configWriter;
9494

@@ -106,8 +106,8 @@ class PluginList extends Scoped implements InterceptionPluginList
106106
* @param array $scopePriorityScheme
107107
* @param string|null $cacheId
108108
* @param SerializerInterface|null $serializer
109-
* @param ConfigLoader|null $configLoader
110-
* @param ConfigWriter|null $configWriter
109+
* @param ConfigLoaderInterface|null $configLoader
110+
* @param ConfigWriterInterface|null $configWriter
111111
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
112112
*/
113113
public function __construct(
@@ -122,8 +122,8 @@ public function __construct(
122122
array $scopePriorityScheme = ['global'],
123123
$cacheId = 'plugins',
124124
SerializerInterface $serializer = null,
125-
ConfigLoader $configLoader = null,
126-
ConfigWriter $configWriter = null
125+
ConfigLoaderInterface $configLoader = null,
126+
ConfigWriterInterface $configWriter = null
127127
) {
128128
$this->serializer = $serializer ?: $objectManager->get(Serialize::class);
129129
parent::__construct($reader, $configScope, $cache, $cacheId, $this->serializer);
@@ -133,8 +133,8 @@ public function __construct(
133133
$this->_classDefinitions = $classDefinitions;
134134
$this->_scopePriorityScheme = $scopePriorityScheme;
135135
$this->_objectManager = $objectManager;
136-
$this->configLoader = $configLoader ?: $this->_objectManager->get(ConfigLoader::class);
137-
$this->configWriter = $configWriter ?: $this->_objectManager->get(ConfigWriter::class);
136+
$this->configLoader = $configLoader ?: $this->_objectManager->get(ConfigLoaderInterface::class);
137+
$this->configWriter = $configWriter ?: $this->_objectManager->get(ConfigWriterInterface::class);
138138
}
139139

140140
/**

setup/src/Magento/Setup/Test/Unit/Console/Command/DiCompileCommandTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public function testExecute()
160160
->with(ProgressBar::class)
161161
->willReturn($progressBar);
162162

163-
$this->managerMock->expects($this->exactly(8))->method('addOperation')
163+
$this->managerMock->expects($this->exactly(9))->method('addOperation')
164164
->withConsecutive(
165165
[OperationFactory::PROXY_GENERATOR, []],
166166
[OperationFactory::REPOSITORY_GENERATOR, $this->anything()],
@@ -178,7 +178,8 @@ public function testExecute()
178178
[OperationFactory::INTERCEPTION, $this->anything()],
179179
[OperationFactory::AREA_CONFIG_GENERATOR, $this->anything()],
180180
[OperationFactory::INTERCEPTION_CACHE, $this->anything()],
181-
[OperationFactory::APPLICATION_ACTION_LIST_GENERATOR, $this->anything()]
181+
[OperationFactory::APPLICATION_ACTION_LIST_GENERATOR, $this->anything()],
182+
[OperationFactory::PLUGIN_LIST_GENERATOR, $this->anything()]
182183
);
183184

184185
$this->managerMock->expects($this->once())->method('process');

0 commit comments

Comments
 (0)