public function initialize() { $sockets = []; $response = $this->getSocketLib()->createPair($this->getDomain(), $this->getType(), $this->getProtocol(), $sockets); if (false($response)) { throw new SocketPairException($this->getSocketLib()->stringError($this->getSocketLib()->lastError())); } $this->left = new Socket(); $this->left->setSocket(reset($sockets)); $this->right = new Socket(); $this->right->setSocket(end($sockets)); }
/** * @expectedException \Thruster\Components\Socket\Exception\SocketException * @expectedExceptionMessage read: foo_bar */ public function testReadFail() { $this->socketLib->expects($this->once())->method('read')->willReturn(false); $this->socketLib->expects($this->once())->method('stringError')->willReturn('foo_bar'); $this->socket->read(10); }
public function __construct($method, Socket $socket) { $message = sprintf('%s: %s', $method, $socket->getLastErrorMessage()); parent::__construct($message); }