Beispiel #1
0
 public function createMessagePong(Message $ping)
 {
     if ($ping->getType() !== Message::TYPE_ECHO_REQUEST) {
         throw new InvalidArgumentException();
     }
     return new Message(Message::TYPE_ECHO_REPLY, 0, null, $ping->getHeader(), $ping->getPayload());
 }
Beispiel #2
0
 public function testGetters()
 {
     $message = new Message(1, 2, 3, 4, 'payload');
     $this->assertEquals(1, $message->getType());
     $this->assertEquals(2, $message->getCode());
     $this->assertEquals(3, $message->getChecksum());
     $this->assertEquals(4, $message->getHeader());
     $this->assertEquals('payload', $message->getPayload());
     $this->assertFalse($message->isChecksumValid());
 }