Skip to content

Commit 43499b3

Browse files
committed
lib/internal/Magento/Framework/Module/Output/ConfigInterface has been removed. The behavior of the Magento\Framework\Module\Manager::isOutputEnabled has changed
1 parent 9d42b6e commit 43499b3

File tree

7 files changed

+6
-226
lines changed

7 files changed

+6
-226
lines changed

app/code/Magento/Store/etc/di.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,6 @@
164164
<argument name="urlPlaceholder" xsi:type="string">{{base_url}}</argument>
165165
</arguments>
166166
</type>
167-
<type name="Magento\Framework\Module\Output\Config">
168-
<arguments>
169-
<argument name="scopeType" xsi:type="const">Magento\Store\Model\ScopeInterface::SCOPE_STORE</argument>
170-
</arguments>
171-
</type>
172167
<type name="Magento\Framework\Session\Config">
173168
<arguments>
174169
<argument name="scopeType" xsi:type="const">Magento\Store\Model\ScopeInterface::SCOPE_STORE</argument>

app/etc/di.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383
<preference for="Magento\Framework\Message\ManagerInterface" type="Magento\Framework\Message\Manager" />
8484
<preference for="Magento\Framework\App\Config\ValueInterface" type="Magento\Framework\App\Config\Value" />
8585
<preference for="Magento\Framework\Interception\ChainInterface" type="Magento\Framework\Interception\Chain\Chain" />
86-
<preference for="Magento\Framework\Module\Output\ConfigInterface" type="Magento\Framework\Module\Output\Config" />
8786
<preference for="Magento\Framework\View\Design\Theme\CustomizationInterface" type="Magento\Framework\View\Design\Theme\Customization" />
8887
<preference for="Magento\Framework\View\Asset\ConfigInterface" type="Magento\Framework\View\Asset\Config" />
8988
<preference for="Magento\Framework\Image\Adapter\ConfigInterface" type="Magento\Framework\Image\Adapter\Config" />

lib/internal/Magento/Framework/Module/Manager.php

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@
2121
*/
2222
class Manager
2323
{
24-
/**
25-
* @var Output\ConfigInterface
26-
* @deprecated 101.0.0
27-
*/
28-
private $outputConfig;
29-
3024
/**
3125
* @var ModuleListInterface
3226
*/
@@ -39,16 +33,13 @@ class Manager
3933
private $outputConfigPaths;
4034

4135
/**
42-
* @param Output\ConfigInterface $outputConfig
4336
* @param ModuleListInterface $moduleList
4437
* @param array $outputConfigPaths
4538
*/
4639
public function __construct(
47-
Output\ConfigInterface $outputConfig,
4840
ModuleListInterface $moduleList,
4941
array $outputConfigPaths = []
5042
) {
51-
$this->outputConfig = $outputConfig;
5243
$this->moduleList = $moduleList;
5344
$this->outputConfigPaths = $outputConfigPaths;
5445
}
@@ -70,34 +61,12 @@ public function isEnabled($moduleName)
7061
* @param string $moduleName Fully-qualified module name
7162
* @return boolean
7263
* @deprecated 101.0.0 Magento does not support disabling/enabling modules output from the Admin Panel since 2.2.0
73-
* version. Module output can still be enabled/disabled in configuration files. However, this functionality should
74-
* not be used in future development. Module design should explicitly state dependencies to avoid requiring output
75-
* disabling. This functionality will temporarily be kept in Magento core, as there are unresolved modularity
76-
* issues that will be addressed in future releases.
64+
* version. Magento does not support disabling/enabling modules output from the configuration files since 2.5.0.
65+
* Module design should explicitly state dependencies to avoid requiring output disabling.
66+
* @see \Magento\Framework\Module\Manager::isEnabled()
7767
*/
7868
public function isOutputEnabled($moduleName)
7969
{
80-
return $this->isEnabled($moduleName)
81-
&& $this->_isCustomOutputConfigEnabled($moduleName)
82-
&& !$this->outputConfig->isEnabled($moduleName);
83-
}
84-
85-
/**
86-
* Whether a configuration switch for a module output permits output or not
87-
*
88-
* @param string $moduleName Fully-qualified module name
89-
* @return boolean
90-
* @deprecated 101.0.0
91-
*/
92-
protected function _isCustomOutputConfigEnabled($moduleName)
93-
{
94-
if (isset($this->outputConfigPaths[$moduleName])) {
95-
$configPath = $this->outputConfigPaths[$moduleName];
96-
if (defined($configPath)) {
97-
$configPath = constant($configPath);
98-
}
99-
return $this->outputConfig->isSetFlag($configPath);
100-
}
101-
return true;
70+
return $this->isEnabled($moduleName);
10271
}
10372
}

lib/internal/Magento/Framework/Module/Output/Config.php

Lines changed: 0 additions & 80 deletions
This file was deleted.

lib/internal/Magento/Framework/Module/Output/ConfigInterface.php

Lines changed: 0 additions & 39 deletions
This file was deleted.

lib/internal/Magento/Framework/Module/Test/Unit/DbVersionInfoTest.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
use Magento\Framework\Module\DbVersionInfo;
1111
use Magento\Framework\Module\ModuleListInterface;
12-
use Magento\Framework\Module\Output\ConfigInterface;
1312
use Magento\Framework\Module\ResourceInterface;
1413
use PHPUnit\Framework\MockObject\MockObject;
1514
use PHPUnit\Framework\TestCase;
@@ -31,11 +30,6 @@ class DbVersionInfoTest extends TestCase
3130
*/
3231
private $moduleResource;
3332

34-
/**
35-
* @var ConfigInterface|MockObject
36-
*/
37-
private $_outputConfig;
38-
3933
protected function setUp(): void
4034
{
4135
$this->moduleList = $this->getMockForAbstractClass(ModuleListInterface::class);
@@ -49,8 +43,6 @@ protected function setUp(): void
4943
$this->moduleList->expects($this->any())
5044
->method('getNames')
5145
->willReturn(['Module_One', 'Module_Two']);
52-
53-
$this->_outputConfig = $this->getMockForAbstractClass(ConfigInterface::class);
5446
$this->moduleResource = $this->getMockForAbstractClass(ResourceInterface::class);
5547

5648
$this->dbVersionInfo = new DbVersionInfo(

lib/internal/Magento/Framework/Module/Test/Unit/ManagerTest.php

Lines changed: 2 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
use Magento\Framework\Module\Manager;
1111
use Magento\Framework\Module\ModuleListInterface;
12-
use Magento\Framework\Module\Output\ConfigInterface;
1312
use PHPUnit\Framework\MockObject\MockObject;
1413
use PHPUnit\Framework\TestCase;
1514

@@ -30,11 +29,6 @@ class ManagerTest extends TestCase
3029
*/
3130
private $_moduleList;
3231

33-
/**
34-
* @var MockObject
35-
*/
36-
private $_outputConfig;
37-
3832
/**
3933
* @inheritdoc
4034
*/
@@ -50,9 +44,8 @@ protected function setUp(): void
5044
['Module_Three', ['name' => 'Two_Three']],
5145
]
5246
);
53-
$this->_outputConfig = $this->getMockForAbstractClass(ConfigInterface::class);
47+
5448
$this->_model = new Manager(
55-
$this->_outputConfig,
5649
$this->_moduleList,
5750
[
5851
'Module_Two' => self::XML_PATH_OUTPUT_ENABLED,
@@ -74,56 +67,7 @@ public function testIsEnabled()
7467

7568
public function testIsOutputEnabledReturnsFalseForDisabledModule()
7669
{
77-
$this->_outputConfig->expects($this->any())->method('isSetFlag')->willReturn(true);
70+
$this->_moduleList->expects($this->once())->method('has')->willReturn(false);
7871
$this->assertFalse($this->_model->isOutputEnabled('Disabled_Module'));
7972
}
80-
81-
/**
82-
* @param bool $configValue
83-
* @param bool $expectedResult
84-
* @dataProvider isOutputEnabledGenericConfigPathDataProvider
85-
*/
86-
public function testIsOutputEnabledGenericConfigPath($configValue, $expectedResult)
87-
{
88-
$this->_moduleList->expects($this->once())->method('has')->willReturn(true);
89-
$this->_outputConfig->expects($this->once())
90-
->method('isEnabled')
91-
->with('Module_One')
92-
->willReturn($configValue);
93-
$this->assertEquals($expectedResult, $this->_model->isOutputEnabled('Module_One'));
94-
}
95-
96-
/**
97-
* @return array
98-
*/
99-
public function isOutputEnabledGenericConfigPathDataProvider()
100-
{
101-
return ['output disabled' => [true, false], 'output enabled' => [false, true]];
102-
}
103-
104-
/**
105-
* @param bool $configValue
106-
* @param bool $expectedResult
107-
* @dataProvider isOutputEnabledCustomConfigPathDataProvider
108-
*/
109-
public function testIsOutputEnabledCustomConfigPath($configValue, $expectedResult)
110-
{
111-
$this->_moduleList->expects($this->once())->method('has')->willReturn(true);
112-
$this->_outputConfig->expects($this->at(0))
113-
->method('isSetFlag')
114-
->with(self::XML_PATH_OUTPUT_ENABLED)
115-
->willReturn($configValue);
116-
$this->assertEquals($expectedResult, $this->_model->isOutputEnabled('Module_Two'));
117-
}
118-
119-
/**
120-
* @return array
121-
*/
122-
public function isOutputEnabledCustomConfigPathDataProvider()
123-
{
124-
return [
125-
'path literal, output disabled' => [false, false],
126-
'path literal, output enabled' => [true, true],
127-
];
128-
}
12973
}

0 commit comments

Comments
 (0)