17 private $interpretationStrategy;
27 private $interpretationMediator;
31 $this->interpretationStrategy = $this->getMockBuilder(
34 ->disableOriginalConstructor()
36 $this->messageMock = $this->createMock(
37 \
Magento\Framework\Message\MessageInterface::class
41 $this->interpretationStrategy
47 $messageText =
'Very awful message. Shame.';
48 $this->messageMock->expects(static::once())
49 ->method(
'getIdentifier')
51 $this->messageMock->expects(static::once())
53 ->willReturn($messageText);
57 $this->interpretationMediator->interpret($this->messageMock)
63 $messageInterpreted =
'Awesome message. An identified message is the one we appreciate.';
65 $this->messageMock->expects(static::once())
66 ->method(
'getIdentifier')
67 ->willReturn(
'Great identifier');
68 $this->interpretationStrategy->expects(static::once())
70 ->with($this->messageMock)
71 ->willReturn($messageInterpreted);
75 $this->interpretationMediator->interpret($this->messageMock)
81 $messageStillNotInterpreted =
'One step left to call it an awesome message.';
83 $this->messageMock->expects(static::once())
84 ->method(
'getIdentifier')
85 ->willReturn(
'Great identifier');
86 $this->messageMock->expects(static::once())
88 ->willReturn($messageStillNotInterpreted);
89 $this->interpretationStrategy->expects(static::once())
91 ->with($this->messageMock)
92 ->willThrowException(
new \LogicException());
95 $messageStillNotInterpreted,
96 $this->interpretationMediator->interpret($this->messageMock)