Inheritance: extends Crummy\Phlack\Common\Event, implements Crummy\Phlack\Common\Encodable
Exemplo n.º 1
0
 public function its_listener_can_accept_a_callable_as_a_matcher(BotInterface $bot, CommandInterface $command, Packet $packet)
 {
     $packet->offsetGet('command')->willReturn($command);
     $packet->offsetSet('output', null)->shouldBeCalled();
     $packet->stopPropagation()->shouldBeCalled();
     $bot->execute($command)->shouldBeCalled();
     $listener = $this->getListener($bot, function ($command) {
         return true;
     });
     $listener($packet);
 }
Exemplo n.º 2
0
 public function it_encodes_the_output(FormatterInterface $formatter, Packet $packet, Reply $reply)
 {
     $unencoded = '<foo!> <#C01010|botgarage>';
     $encoded = '&lt;foo!&gt; <#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);
 }