Skip to content

Commit 7d9d703

Browse files
committed
Merge commit 'refs/pull/3779/head' of https://github.com/magento/magento2 into MAGETWO-56556
2 parents 9d0c8f9 + 05b40d1 commit 7d9d703

File tree

6 files changed

+25
-8
lines changed

6 files changed

+25
-8
lines changed

app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Options/AjaxTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function testToHtml()
5353
->disableOriginalConstructor()
5454
->setMethods(['dispatch'])
5555
->getMock();
56-
$eventManager->expects($this->once())->method('dispatch')->will($this->returnValue(true));
56+
$eventManager->expects($this->exactly(2))->method('dispatch')->will($this->returnValue(true));
5757

5858
$scopeConfig = $this->getMockBuilder(\Magento\Framework\App\Config::class)
5959
->setMethods(['getValue'])

app/code/Magento/Catalog/Test/Unit/Block/Product/Widget/NewWidgetTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public function testGetProductsCount()
186186

187187
protected function generalGetProductCollection()
188188
{
189-
$this->eventManager->expects($this->once())->method('dispatch')
189+
$this->eventManager->expects($this->exactly(2))->method('dispatch')
190190
->will($this->returnValue(true));
191191
$this->scopeConfig->expects($this->once())->method('getValue')->withAnyParameters()
192192
->willReturn(false);

app/code/Magento/Paypal/Test/Unit/Block/Billing/AgreementsTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,14 @@ public function testGetWizardPaymentMethodOptions()
235235
public function testToHtml()
236236
{
237237
$this->eventManager
238-
->expects($this->once())
238+
->expects($this->at(0))
239239
->method('dispatch')
240240
->with('view_block_abstract_to_html_before', ['block' => $this->block]);
241+
$transport = new \Magento\Framework\DataObject(['html' => '']);
242+
$this->eventManager
243+
->expects($this->at(1))
244+
->method('dispatch')
245+
->with('view_block_abstract_to_html_after', ['block' => $this->block, 'transport' => $transport]);
241246
$this->scopeConfig
242247
->expects($this->once())
243248
->method('getValue')

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,12 @@ public function testToHtml($customerId)
261261
$this->additional->setData('cache_lifetime', 789);
262262
$this->additional->setData('cache_key', 'cache-key');
263263

264-
$this->eventManagerMock->expects($this->once())
264+
$this->eventManagerMock->expects($this->at(0))
265265
->method('dispatch')
266266
->with('view_block_abstract_to_html_before', ['block' => $this->additional]);
267+
$this->eventManagerMock->expects($this->at(1))
268+
->method('dispatch')
269+
->with('view_block_abstract_to_html_after');
267270
$this->scopeConfigMock->expects($this->once())
268271
->method('getValue')
269272
->with(

app/code/Magento/Widget/Test/Unit/Block/Adminhtml/Widget/Instance/Edit/Chooser/ContainerTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function testToHtmlCatalogProductsListGroupedProduct()
6666
. 'Main Content Area</option><option value="content.bottom" >Main Content Bottom</option>'
6767
. '<option value="content.top" >Main Content Top</option></select>';
6868

69-
$this->eventManagerMock->expects($this->once())->method('dispatch')->willReturn(true);
69+
$this->eventManagerMock->expects($this->exactly(2))->method('dispatch')->willReturn(true);
7070
$this->scopeConfigMock->expects($this->once())->method('getValue')->willReturn(false);
7171

7272
$this->themeCollectionFactoryMock->expects($this->once())
@@ -153,7 +153,7 @@ public function testToHtmlCatalogCategoryLinkSimpleProduct()
153153
. '<option value="sidebar.additional" >Sidebar Additional</option>'
154154
. '<option value="sidebar.main" >Sidebar Main</option></select>';
155155

156-
$this->eventManagerMock->expects($this->once())->method('dispatch')->willReturn(true);
156+
$this->eventManagerMock->expects($this->exactly(2))->method('dispatch')->willReturn(true);
157157
$this->scopeConfigMock->expects($this->once())->method('getValue')->willReturn(false);
158158

159159
$this->themeCollectionFactoryMock->expects($this->once())
@@ -284,7 +284,7 @@ public function testToHtmlCmsStaticBlockAllProductTypes()
284284
. '<option value="sidebar.additional" >Sidebar Additional</option>'
285285
. '<option value="sidebar.main" >Sidebar Main</option></select>';
286286

287-
$this->eventManagerMock->expects($this->once())->method('dispatch')->willReturn(true);
287+
$this->eventManagerMock->expects($this->exactly(2))->method('dispatch')->willReturn(true);
288288
$this->scopeConfigMock->expects($this->once())->method('getValue')->willReturn(false);
289289

290290
$this->themeCollectionFactoryMock->expects($this->once())
@@ -402,7 +402,7 @@ public function testToHtmlOrderBySkuAllPages()
402402
. '<option value="sidebar.additional" >Sidebar Additional</option><option value="sidebar.main" >'
403403
. 'Sidebar Main</option></select>';
404404

405-
$this->eventManagerMock->expects($this->once())->method('dispatch')->willReturn(true);
405+
$this->eventManagerMock->expects($this->exactly(2))->method('dispatch')->willReturn(true);
406406
$this->scopeConfigMock->expects($this->once())->method('getValue')->willReturn(false);
407407

408408
$this->themeCollectionFactoryMock->expects($this->once())

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,15 @@ public function toHtml()
670670
}
671671
$html = $this->_afterToHtml($html);
672672

673+
/** @var \Magento\Framework\DataObject */
674+
$transportObject = new \Magento\Framework\DataObject(
675+
[
676+
'html' => $html,
677+
]
678+
);
679+
$this->_eventManager->dispatch('view_block_abstract_to_html_after', ['block' => $this, 'transport' => $transportObject]);
680+
$html = $transportObject->getHtml();
681+
673682
return $html;
674683
}
675684

0 commit comments

Comments
 (0)