public function testSetter() { $factory = new MessageFactory(); $message = $factory->make('test'); $message->setPrefix($set = uniqid()); $this->assertEquals($message->getPrefix(), $set); }
/** * @param ConnectionInterface $connection * @param string $string * @return void */ public function handleRaw(ConnectionInterface $connection, $string) { $message = $this->factory->getMessageFromRaw($string); $message->setConnection($connection); foreach ($this->getActions($message->getCommand()) as $action) { $action->handleMessage($message); } foreach ($this->getActions('*') as $action) { $action->handleMessage($message); } }
public function testHandleMessage() { $mock = $this->getMock('\\Buttress\\IRC\\Connection\\ConnectionInterface'); $mock->expects($this->once())->method('sendMessage'); $factory = new MessageFactory(); $pingAction = new PingAction(); $pingAction->handleConnect($mock); $message = $factory->make('PING', '', array('testing.ping')); $message->setConnection($mock); $pingAction->handleMessage($message); }
public function testUnsupported() { $mock = $this->getMock('\\Buttress\\IRC\\Connection\\ConnectionInterface'); $mock->expects($this->exactly(0))->method('sendMessage'); $factory = new MessageFactory(); $message = $factory->getMessageFromRaw(":Korvin!~korvin@concrete5/79063/Korvin PRIVMSG Buttress :UNSUPPORTED test"); $message->setConnection($mock); $action = new CTCPAction(); $action->handleConnect($mock); $action->handleMessage($message); }
public function testConstructPing() { $factory = new MessageFactory(); $this->assertInstanceOf('\\Buttress\\IRC\\Message\\PingMessage', $factory->make('ping')); }