19 private $renderersPool;
24 private $messageConfigurationsPool;
39 private $interpretationStrategy;
43 $this->renderersPool = $this->getMockBuilder(
46 ->disableOriginalConstructor()
48 $this->messageConfigurationsPool = $this->getMockBuilder(
51 ->disableOriginalConstructor()
53 $this->messageMock = $this->createMock(
54 \
Magento\Framework\Message\MessageInterface::class
56 $this->renderer = $this->createMock(
62 $this->messageConfigurationsPool
68 $identifier =
'Prophesy';
69 $messageConfiguration = [
70 'renderer' =>
'Third apostle from the left',
72 'Blessed are the birds...' 75 $renderedMessage =
'Script';
77 $renderer = $this->createMock(
81 $this->messageMock->expects(static::once())
82 ->method(
'getIdentifier')
83 ->willReturn($identifier);
84 $this->messageConfigurationsPool->expects(static::once())
85 ->method(
'getMessageConfiguration')
90 $this->renderersPool->expects(static::once())
92 ->with($messageConfiguration[
'renderer'])
93 ->willReturn($renderer);
94 $renderer->expects(static::once())
96 ->with($this->messageMock, $messageConfiguration[
'data'])
97 ->willReturn($renderedMessage);
101 $this->interpretationStrategy->interpret($this->messageMock)
107 $identifier =
'Prophesy';
109 $this->messageMock->expects(static::once())
110 ->method(
'getIdentifier')
111 ->willReturn($identifier);
112 $this->messageConfigurationsPool->expects(static::once())
113 ->method(
'getMessageConfiguration')
119 $this->expectException(
'LogicException');
121 $this->renderersPool->expects(static::never())
124 $this->interpretationStrategy->interpret($this->messageMock);
129 $identifier =
'Prophesy';
130 $messageConfiguration = [
131 'renderer' =>
'Third apostle from the left',
133 'Blessed are the birds...' 137 $this->messageMock->expects(static::once())
138 ->method(
'getIdentifier')
139 ->willReturn($identifier);
140 $this->messageConfigurationsPool->expects(static::once())
141 ->method(
'getMessageConfiguration')
144 $messageConfiguration
146 $this->renderersPool->expects(static::once())
148 ->with($messageConfiguration[
'renderer'])
151 $this->expectException(
'LogicException');
153 $this->interpretationStrategy->interpret($this->messageMock);
testInterpretNoConfigurationException()
testInterpretNoInterpreterException()