Skip to content

Commit 5d1c9a2

Browse files
author
Eric Bohanon
committed
MAGETWO-71257: Need to disable module output by configuration
1 parent 15eeba8 commit 5d1c9a2

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

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

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,53 @@ public function testIsEnabled()
6161
$this->assertTrue($this->_model->isEnabled('Module_Exists'));
6262
$this->assertFalse($this->_model->isEnabled('Module_NotExists'));
6363
}
64+
65+
public function testIsOutputEnabledReturnsFalseForDisabledModule()
66+
{
67+
$this->_outputConfig->expects($this->any())->method('isSetFlag')->will($this->returnValue(true));
68+
$this->assertFalse($this->_model->isOutputEnabled('Disabled_Module'));
69+
}
70+
71+
/**
72+
* @param bool $configValue
73+
* @param bool $expectedResult
74+
* @dataProvider isOutputEnabledGenericConfigPathDataProvider
75+
*/
76+
public function testIsOutputEnabledGenericConfigPath($configValue, $expectedResult)
77+
{
78+
$this->_moduleList->expects($this->once())->method('has')->will($this->returnValue(true));
79+
$this->_outputConfig->expects($this->once())
80+
->method('isEnabled')
81+
->with('Module_One')
82+
->will($this->returnValue($configValue));
83+
$this->assertEquals($expectedResult, $this->_model->isOutputEnabled('Module_One'));
84+
}
85+
86+
public function isOutputEnabledGenericConfigPathDataProvider()
87+
{
88+
return ['output disabled' => [true, false], 'output enabled' => [false, true]];
89+
}
90+
91+
/**
92+
* @param bool $configValue
93+
* @param bool $expectedResult
94+
* @dataProvider isOutputEnabledCustomConfigPathDataProvider
95+
*/
96+
public function testIsOutputEnabledCustomConfigPath($configValue, $expectedResult)
97+
{
98+
$this->_moduleList->expects($this->once())->method('has')->will($this->returnValue(true));
99+
$this->_outputConfig->expects($this->at(0))
100+
->method('isSetFlag')
101+
->with(self::XML_PATH_OUTPUT_ENABLED)
102+
->will($this->returnValue($configValue));
103+
$this->assertEquals($expectedResult, $this->_model->isOutputEnabled('Module_Two'));
104+
}
105+
106+
public function isOutputEnabledCustomConfigPathDataProvider()
107+
{
108+
return [
109+
'path literal, output disabled' => [false, false],
110+
'path literal, output enabled' => [true, true],
111+
];
112+
}
64113
}

0 commit comments

Comments
 (0)