예제 #1
0
 public function testSetter()
 {
     $factory = new MessageFactory();
     $message = $factory->make('test');
     $message->setPrefix($set = uniqid());
     $this->assertEquals($message->getPrefix(), $set);
 }
예제 #2
0
 /**
  * @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);
     }
 }
예제 #3
0
 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);
 }
예제 #4
0
 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);
 }
예제 #5
0
 public function testConstructPing()
 {
     $factory = new MessageFactory();
     $this->assertInstanceOf('\\Buttress\\IRC\\Message\\PingMessage', $factory->make('ping'));
 }