Skip to content

Commit f725693

Browse files
MAGETWO-62710: Remove Advanced section
1 parent 78230b7 commit f725693

File tree

8 files changed

+59
-182
lines changed

8 files changed

+59
-182
lines changed

app/code/Magento/Backend/Block/Template.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,12 @@ public function getFormKey()
7070
*
7171
* @param string $moduleName Full module name
7272
* @return boolean
73+
* @deprecated
74+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
7375
*/
7476
public function isOutputEnabled($moduleName = null)
7577
{
76-
if ($moduleName === null) {
77-
$moduleName = $this->getModuleName();
78-
}
79-
80-
return !$this->_scopeConfig->isSetFlag(
81-
'advanced/modules_disable_output/' . $moduleName,
82-
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
83-
);
78+
return true;
8479
}
8580

8681
/**

app/code/Magento/Payment/Test/Unit/Block/Info/SubstitutionTest.php

Lines changed: 51 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
* Copyright © 2016 Magento. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
7-
// @codingStandardsIgnoreFile
8-
96
namespace Magento\Payment\Test\Unit\Block\Info;
107

118
/**
@@ -31,71 +28,23 @@ class SubstitutionTest extends \PHPUnit_Framework_TestCase
3128
protected function setUp()
3229
{
3330
$this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
34-
35-
$this->layout = $this->getMockBuilder(
36-
\Magento\Framework\View\LayoutInterface::class
37-
)->disableOriginalConstructor()->setMethods(
38-
[]
39-
)->getMock();
40-
41-
$eventManager = $this->getMockBuilder(
42-
\Magento\Framework\Event\ManagerInterface::class
43-
)->disableOriginalConstructor()->setMethods(
44-
[]
45-
)->getMock();
46-
47-
$scopeConfig = $this->getMockBuilder(
48-
\Magento\Framework\App\Config\ScopeConfigInterface::class
49-
)->disableOriginalConstructor()->setMethods(
50-
[]
51-
)->getMock();
52-
$scopeConfig->expects(
53-
$this->any()
54-
)->method(
55-
'getValue'
56-
)->with(
57-
$this->stringContains(
58-
'advanced/modules_disable_output/'
59-
),
60-
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
61-
)->will(
62-
$this->returnValue(
63-
false
64-
)
65-
);
66-
67-
$context = $this->getMockBuilder(
68-
\Magento\Framework\View\Element\Template\Context::class
69-
)->disableOriginalConstructor()->setMethods(
70-
['getLayout', 'getEventManager', 'getScopeConfig']
71-
)->getMock();
72-
$context->expects(
73-
$this->any()
74-
)->method(
75-
'getLayout'
76-
)->will(
77-
$this->returnValue(
78-
$this->layout
79-
)
80-
);
81-
$context->expects(
82-
$this->any()
83-
)->method(
84-
'getEventManager'
85-
)->will(
86-
$this->returnValue(
87-
$eventManager
88-
)
89-
);
90-
$context->expects(
91-
$this->any()
92-
)->method(
93-
'getScopeConfig'
94-
)->will(
95-
$this->returnValue(
96-
$scopeConfig
97-
)
98-
);
31+
$this->layout = $this->getMockBuilder(\Magento\Framework\View\LayoutInterface::class)
32+
->disableOriginalConstructor()
33+
->setMethods([])
34+
->getMock();
35+
$eventManager = $this->getMockBuilder(\Magento\Framework\Event\ManagerInterface::class)
36+
->disableOriginalConstructor()
37+
->setMethods([])
38+
->getMock();
39+
$context = $this->getMockBuilder(\Magento\Framework\View\Element\Template\Context::class)
40+
->disableOriginalConstructor()
41+
->setMethods(['getLayout', 'getEventManager', 'getScopeConfig'])
42+
->getMock();
43+
$context->expects($this->any())
44+
->method('getLayout')
45+
->willReturn($this->layout);
46+
$context->expects($this->any())->method('getEventManager')
47+
->willReturn($eventManager);
9948

10049
$this->block = $this->objectManager->getObject(
10150
\Magento\Payment\Block\Info\Substitution::class,
@@ -110,52 +59,44 @@ protected function setUp()
11059

11160
public function testBeforeToHtml()
11261
{
113-
$abstractBlock = $this->getMockBuilder(
114-
\Magento\Framework\View\Element\AbstractBlock::class
115-
)->disableOriginalConstructor()->setMethods(
116-
[]
117-
)->getMock();
118-
$childAbstractBlock = clone($abstractBlock);
119-
120-
$abstractBlock->expects($this->any())->method('getParentBlock')->will($this->returnValue($childAbstractBlock));
62+
$abstractBlock = $this->getMockBuilder(\Magento\Framework\View\Element\AbstractBlock::class)
63+
->disableOriginalConstructor()
64+
->setMethods([])
65+
->getMock();
66+
$childAbstractBlock = clone $abstractBlock;
67+
68+
$abstractBlock->expects($this->any())
69+
->method('getParentBlock')
70+
->willReturn($childAbstractBlock);
71+
$this->layout->expects($this->any())
72+
->method('getParentName')
73+
->willReturn('parentName');
74+
$this->layout->expects($this->any())
75+
->method('getBlock')
76+
->willReturn($abstractBlock);
77+
78+
$infoMock = $this->getMockBuilder(\Magento\Payment\Model\Info::class)
79+
->disableOriginalConstructor()->setMethods([])
80+
->getMock();
81+
$methodMock = $this->getMockBuilder(\Magento\Payment\Model\MethodInterface::class)
82+
->getMockForAbstractClass();
83+
$infoMock->expects($this->once())
84+
->method('getMethodInstance')
85+
->willReturn($methodMock);
12186

122-
$this->layout->expects($this->any())->method('getParentName')->will($this->returnValue('parentName'));
123-
$this->layout->expects($this->any())->method('getBlock')->will($this->returnValue($abstractBlock));
124-
125-
$infoMock = $this->getMockBuilder(
126-
\Magento\Payment\Model\Info::class
127-
)->disableOriginalConstructor()->setMethods(
128-
[]
129-
)->getMock();
130-
$methodMock = $this->getMockBuilder(
131-
\Magento\Payment\Model\MethodInterface::class
132-
)->getMockForAbstractClass();
133-
$infoMock->expects($this->once())->method('getMethodInstance')->will($this->returnValue($methodMock));
13487
$this->block->setInfo($infoMock);
13588

13689
$fakeBlock = new \StdClass();
137-
$this->layout->expects(
138-
$this->any()
139-
)->method(
140-
'createBlock'
141-
)->with(
142-
\Magento\Framework\View\Element\Template::class,
143-
'',
144-
['data' => ['method' => $methodMock, 'template' => 'Magento_Payment::info/substitution.phtml']]
145-
)->will(
146-
$this->returnValue(
147-
$fakeBlock
148-
)
149-
);
150-
151-
$childAbstractBlock->expects(
152-
$this->any()
153-
)->method(
154-
'setChild'
155-
)->with(
156-
'order_payment_additional',
157-
$fakeBlock
158-
);
90+
$this->layout->expects($this->any())
91+
->method('createBlock')
92+
->with(
93+
\Magento\Framework\View\Element\Template::class, '',
94+
['data' => ['method' => $methodMock, 'template' => 'Magento_Payment::info/substitution.phtml']]
95+
)->willReturn($fakeBlock);
96+
97+
$childAbstractBlock->expects($this->any())
98+
->method('setChild')
99+
->with('order_payment_additional', $fakeBlock);
159100

160101
$this->block->toHtml();
161102
}

app/code/Magento/Paypal/Test/Unit/Block/Express/ReviewTest.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33
* Copyright © 2016 Magento. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
76
namespace Magento\Paypal\Test\Unit\Block\Express;
87

98
use Magento\Paypal\Block\Express\Review;
10-
use Magento\Quote\Model\Quote\Address\Rate;
119

1210
/**
1311
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -35,14 +33,6 @@ protected function setUp()
3533

3634
$layout = $this->getMock(\Magento\Framework\View\LayoutInterface::class, [], [], '', false);
3735
$eventManager = $this->getMock(\Magento\Framework\Event\ManagerInterface::class, [], [], '', false);
38-
$scopeConfig = $this->getMock(\Magento\Framework\App\Config\ScopeConfigInterface::class, [], [], '', false);
39-
40-
$scopeConfig->expects($this->any())
41-
->method('getValue')
42-
->with(
43-
$this->stringContains('advanced/modules_disable_output/'),
44-
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
45-
)->will($this->returnValue(false));
4636

4737
$urlBuilder = $this->getMock(\Magento\Framework\UrlInterface::class);
4838
$urlBuilder->expects($this->any())->method('getUrl')->will($this->returnArgument(0));
@@ -60,7 +50,6 @@ protected function setUp()
6050

6151
$context->expects($this->any())->method('getLayout')->will($this->returnValue($layout));
6252
$context->expects($this->any())->method('getEventManager')->will($this->returnValue($eventManager));
63-
$context->expects($this->any())->method('getScopeConfig')->will($this->returnValue($scopeConfig));
6453
$context->expects($this->any())->method('getRequest')->will($this->returnValue($this->request));
6554
$context->expects($this->any())->method('getAssetRepository')->will($this->returnValue($this->assetRepo));
6655
$context->expects($this->any())->method('getUrlBuilder')->will($this->returnValue($urlBuilder));

app/code/Magento/Persistent/Test/Unit/Block/Header/AdditionalTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -267,12 +267,6 @@ public function testToHtml($customerId)
267267
$this->eventManagerMock->expects($this->at(1))
268268
->method('dispatch')
269269
->with('view_block_abstract_to_html_after');
270-
$this->scopeConfigMock->expects($this->once())
271-
->method('getValue')
272-
->with(
273-
'advanced/modules_disable_output/Magento_Persistent',
274-
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
275-
)->willReturn(false);
276270

277271
// get cache
278272
$this->cacheStateMock->expects($this->at(0))

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,6 @@ public function testGetRssData()
164164
->method('getValue')
165165
->will($this->returnValueMap(
166166
[
167-
[
168-
'advanced/modules_disable_output/Magento_Rss',
169-
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
170-
null,
171-
null,
172-
],
173167
[
174168
Data::XML_PATH_DEFAULT_LOCALE,
175169
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,

dev/tests/integration/testsuite/Magento/Backend/Block/TemplateTest.php

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -34,26 +34,4 @@ public function testGetFormKey()
3434
{
3535
$this->assertGreaterThan(15, strlen($this->_block->getFormKey()));
3636
}
37-
38-
/**
39-
* @magentoAppArea adminhtml
40-
* @covers \Magento\Backend\Block\Template::isOutputEnabled
41-
* @magentoConfigFixture current_store advanced/modules_disable_output/dummy 1
42-
*/
43-
public function testIsOutputEnabledTrue()
44-
{
45-
$this->_block->setData('module_name', 'dummy');
46-
$this->assertFalse($this->_block->isOutputEnabled('dummy'));
47-
}
48-
49-
/**
50-
* @magentoAppArea adminhtml
51-
* @covers \Magento\Backend\Block\Template::isOutputEnabled
52-
* @magentoConfigFixture current_store advanced/modules_disable_output/dummy 0
53-
*/
54-
public function testIsOutputEnabledFalse()
55-
{
56-
$this->_block->setData('module_name', 'dummy');
57-
$this->assertTrue($this->_block->isOutputEnabled('dummy'));
58-
}
5937
}

lib/internal/Magento/Framework/View/Element/AbstractBlock.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -647,12 +647,6 @@ protected function _beforeToHtml()
647647
public function toHtml()
648648
{
649649
$this->_eventManager->dispatch('view_block_abstract_to_html_before', ['block' => $this]);
650-
if ($this->_scopeConfig->getValue(
651-
'advanced/modules_disable_output/' . $this->getModuleName(),
652-
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
653-
)) {
654-
return '';
655-
}
656650

657651
$html = $this->_loadCache();
658652
if ($html === false) {

lib/internal/Magento/Framework/View/Test/Unit/Element/AbstractBlockTest.php

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
* Copyright © 2016 Magento. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
7-
// @codingStandardsIgnoreFile
8-
96
namespace Magento\Framework\View\Test\Unit\Element;
107

118
use Magento\Framework\View\Element\AbstractBlock;
@@ -207,13 +204,12 @@ public function testToHtmlWhenModuleIsDisabled()
207204
$moduleName = 'Test';
208205
$this->block->setData('module_name', $moduleName);
209206

210-
$this->eventManagerMock->expects($this->any())
207+
$this->eventManagerMock->expects($this->exactly(2))
211208
->method('dispatch')
212-
->with('view_block_abstract_to_html_before', ['block' => $this->block]);
213-
$this->scopeConfigMock->expects($this->once())
214-
->method('getValue')
215-
->with('advanced/modules_disable_output/' . $moduleName, \Magento\Store\Model\ScopeInterface::SCOPE_STORE)
216-
->willReturn(true);
209+
->willReturnMap([
210+
['view_block_abstract_to_html_before', ['block' => $this->block]],
211+
['view_block_abstract_to_html_after', ['block' => $this->block]],
212+
]);
217213

218214
$this->assertSame('', $this->block->toHtml());
219215
}
@@ -246,10 +242,6 @@ public function testGetCacheLifetimeViaToHtml(
246242

247243
$this->eventManagerMock->expects($expectsDispatchEvent)
248244
->method('dispatch');
249-
$this->scopeConfigMock->expects($this->once())
250-
->method('getValue')
251-
->with('advanced/modules_disable_output/' . $moduleName, \Magento\Store\Model\ScopeInterface::SCOPE_STORE)
252-
->willReturn(false);
253245
$this->cacheStateMock->expects($this->any())
254246
->method('isEnabled')
255247
->with(AbstractBlock::CACHE_GROUP)

0 commit comments

Comments
 (0)