public function it_encodes_the_output(FormatterInterface $formatter, Packet $packet, Reply $reply) { $unencoded = '<foo!> <#C01010|botgarage>'; $encoded = '<foo!> <#C01010|botgarage>'; $packet->offsetExists('output')->willReturn(true); $packet->offsetGet('output')->willReturn($reply); $reply->offsetExists('text')->willReturn(true); $reply->offsetGet('text')->willReturn($unencoded); $formatter->format($unencoded)->willReturn($encoded); $reply->offsetSet('text', $encoded)->shouldBeCalled(); $this->onAfterExecute($packet); }