Пример #1
0
 public function testReceivedPackageWithHandler()
 {
     $packet = $this->getMockBuilder('\\Thruster\\Components\\InterProcessCommunication\\Packet')->getMock();
     $connection = $this->getMockBuilder('\\Thruster\\Components\\InterProcessCommunication\\Connection')->getMock();
     $packet->expects($this->once())->method('setConnection')->with($connection);
     $packet->expects($this->once())->method('getType')->willReturn('foo');
     $mock = $this->getMockBuilder(__CLASS__)->getMock();
     $mock->expects($this->once())->method('testReceivedPackageWithHandler')->with($packet, $this->packetHandler);
     $this->packetHandler->addHandler('foo', [$mock, 'testReceivedPackageWithHandler']);
     $this->packetHandler->receivedPackage($packet, $connection);
 }