Ejemplo n.º 1
0
 public function testReceivePacket()
 {
     $packet = new Packet();
     $mock = $this->getMockBuilder(__CLASS__)->getMock();
     $mock->expects($this->once())->method('testReceivePacket')->willReturnCallback(function ($givenPacket) use($packet) {
         $this->assertEquals($packet, $givenPacket);
     });
     $this->driver->expects($this->once())->method('read')->willReturn($packet);
     $this->connection->onPacketReceived([$mock, 'testReceivePacket']);
     $this->connection->receivePacket();
 }