22 private $blockTemplate;
26 $this->blockTemplate = $this->getMockBuilder(
29 ->disableOriginalConstructor()
35 public function testRender()
38 $message = $this->createMock(\
Magento\Framework\Message\MessageInterface::class);
40 'painting' =>
'The Last Supper',
44 $initializationData = [
'template' =>
'canvas.phtml'];
45 $messagePresentation =
'The Last Supper, Michelangelo.';
49 ->willReturn($messageData);
51 ->method(
'setTemplate')
52 ->with($initializationData[
'template']);
53 $this->blockTemplate->expects(static::once())
57 $this->blockTemplate->expects(static::once())
59 ->willReturn($messagePresentation);
66 ->with(
'apostles_cnt');
69 ->with(
'kangaroos_cnt');
71 ->method(
'setTemplate')
74 $this->renderer->render(
$message, $initializationData);
77 public function testRenderNoTemplate()
80 $message = $this->createMock(\
Magento\Framework\Message\MessageInterface::class);
83 'is' =>
'a Very Naughty Boy' 88 ->willReturn($messageData);
90 $this->expectException(
'InvalidArgumentException');
91 $this->expectExceptionMessage(
'Template should be provided for the renderer.');
93 $this->blockTemplate->expects(static::never())
96 $this->renderer->render(
$message, []);