Ejemplo n.º 1
0
 public function testSendPacketAsSlave()
 {
     $packet = new Packet();
     $this->driver->expects($this->once())->method('write')->with($packet);
     $this->posix->expects($this->once())->method('getParentPid')->willReturn(10);
     $this->signalHandler->expects($this->once())->method('send')->willReturnCallback(function ($signal) {
         $this->assertInstanceOf('\\Thruster\\Components\\PosixSignalHandler\\Signal', $signal);
         $this->assertSame(SIGUSR1, $signal->getSignalNo());
         $this->assertSame(10, $signal->getDestination());
         return $this->signalHandler;
     });
     $this->connection->setSlaveMode();
     $this->connection->sendPacket($packet);
     $this->assertSame(10, $this->connection->getParentPid());
 }