Skip to content

Commit d410155

Browse files
committed
MAGETWO-56556: [GITHUB PR#3779] Add dispatching of view_block_abstract_to_html_after event
- fix Unit tests
1 parent 7d9d703 commit d410155

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,10 @@ public function toHtml()
676676
'html' => $html,
677677
]
678678
);
679-
$this->_eventManager->dispatch('view_block_abstract_to_html_after', ['block' => $this, 'transport' => $transportObject]);
679+
$this->_eventManager->dispatch('view_block_abstract_to_html_after', [
680+
'block' => $this,
681+
'transport' => $transportObject
682+
]);
680683
$html = $transportObject->getHtml();
681684

682685
return $html;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ public function testToHtmlWhenModuleIsDisabled()
204204
$moduleName = 'Test';
205205
$this->block->setData('module_name', $moduleName);
206206

207-
$this->eventManagerMock->expects($this->once())
207+
$this->eventManagerMock->expects($this->exactly(2))
208208
->method('dispatch')
209209
->with('view_block_abstract_to_html_before', ['block' => $this->block]);
210210
$this->scopeConfigMock->expects($this->once())
@@ -239,7 +239,7 @@ public function testGetCacheLifetimeViaToHtml(
239239
$this->block->setData('module_name', $moduleName);
240240
$this->block->setData('cache_lifetime', $cacheLifetime);
241241

242-
$this->eventManagerMock->expects($this->once())
242+
$this->eventManagerMock->expects($this->exactly(2))
243243
->method('dispatch')
244244
->with('view_block_abstract_to_html_before', ['block' => $this->block]);
245245
$this->scopeConfigMock->expects($this->once())

0 commit comments

Comments
 (0)