Skip to content

Commit 8f2f48c

Browse files
author
Eric Bohanon
committed
MAGETWO-71257: Need to disable module output by configuration
1 parent c160414 commit 8f2f48c

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

app/code/Magento/Robots/Test/Unit/Block/DataTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,19 @@ class DataTest extends \PHPUnit\Framework\TestCase
3232
*/
3333
private $eventManagerMock;
3434

35+
/**
36+
* @var \Magento\Framework\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject
37+
*/
38+
private $scopeConfigMock;
39+
3540
protected function setUp()
3641
{
3742
$this->eventManagerMock = $this->getMockBuilder(\Magento\Framework\Event\ManagerInterface::class)
3843
->getMockForAbstractClass();
3944

45+
$this->scopeConfigMock = $this->getMockBuilder(\Magento\Framework\App\Config\ScopeConfigInterface::class)
46+
->getMockForAbstractClass();
47+
4048
$this->context = $this->getMockBuilder(\Magento\Framework\View\Element\Context::class)
4149
->disableOriginalConstructor()
4250
->getMock();
@@ -45,6 +53,10 @@ protected function setUp()
4553
->method('getEventManager')
4654
->willReturn($this->eventManagerMock);
4755

56+
$this->context->expects($this->any())
57+
->method('getScopeConfig')
58+
->willReturn($this->scopeConfigMock);
59+
4860
$this->robots = $this->getMockBuilder(\Magento\Robots\Model\Robots::class)
4961
->disableOriginalConstructor()
5062
->getMock();
@@ -69,6 +81,8 @@ public function testToHtml()
6981

7082
$this->initEventManagerMock($data);
7183

84+
$this->scopeConfigMock->expects($this->once())->method('getValue')->willReturn(false);
85+
7286
$this->robots->expects($this->once())
7387
->method('getData')
7488
->willReturn($data);

app/code/Magento/Sitemap/Test/Unit/Block/RobotsTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ class RobotsTest extends \PHPUnit\Framework\TestCase
4040
*/
4141
private $eventManagerMock;
4242

43+
/**
44+
* @var \Magento\Framework\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject
45+
*/
46+
private $scopeConfigMock;
47+
4348
/**
4449
* @var \Magento\Store\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject
4550
*/
@@ -50,6 +55,9 @@ protected function setUp()
5055
$this->eventManagerMock = $this->getMockBuilder(\Magento\Framework\Event\ManagerInterface::class)
5156
->getMockForAbstractClass();
5257

58+
$this->scopeConfigMock = $this->getMockBuilder(\Magento\Framework\App\Config\ScopeConfigInterface::class)
59+
->getMockForAbstractClass();
60+
5361
$this->context = $this->getMockBuilder(\Magento\Framework\View\Element\Context::class)
5462
->disableOriginalConstructor()
5563
->getMock();
@@ -58,6 +66,10 @@ protected function setUp()
5866
->method('getEventManager')
5967
->willReturn($this->eventManagerMock);
6068

69+
$this->context->expects($this->any())
70+
->method('getScopeConfig')
71+
->willReturn($this->scopeConfigMock);
72+
6173
$this->storeResolver = $this->getMockBuilder(\Magento\Store\Model\StoreResolver::class)
6274
->disableOriginalConstructor()
6375
->getMock();
@@ -95,6 +107,7 @@ public function testToHtmlRobotsSubmissionIsDisabled()
95107
$expected = '';
96108

97109
$this->initEventManagerMock($expected);
110+
$this->scopeConfigMock->expects($this->once())->method('getValue')->willReturn(false);
98111

99112
$this->storeResolver->expects($this->once())
100113
->method('getCurrentStoreId')
@@ -150,6 +163,7 @@ public function testAfterGetDataRobotsSubmissionIsEnabled()
150163
. PHP_EOL;
151164

152165
$this->initEventManagerMock($expected);
166+
$this->scopeConfigMock->expects($this->once())->method('getValue')->willReturn(false);
153167

154168
$this->storeResolver->expects($this->once())
155169
->method('getCurrentStoreId')

app/code/Magento/Wishlist/Test/Unit/Model/Rss/WishlistTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ public function testGetRssData()
154154
->will($this->returnValue($wishlistSharingUrl));
155155
$this->scopeConfig->expects($this->any())
156156
->method('getValue')
157-
->will($this->returnValueMap(
157+
->will(
158+
$this->returnValueMap(
158159
[
159160
[
160161
'advanced/modules_disable_output/Magento_Rss',

0 commit comments

Comments
 (0)