本文整理汇总了PHP中ZMQSocket::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP ZMQSocket::expects方法的具体用法?PHP ZMQSocket::expects怎么用?PHP ZMQSocket::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZMQSocket
的用法示例。
在下文中一共展示了ZMQSocket::expects方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testMissingRequestReturnNull
public function testMissingRequestReturnNull()
{
$this->socket->expects($this->once())->method('send')->with(TaskManager::MESSAGE_PROCESS_UPDATE);
$this->socket->expects($this->once())->method('recv')->will($this->returnValue(json_encode(['request' => TaskManager::MESSAGE_PROCESS_UPDATE])));
$this->setExpectedException(RuntimeException::class, 'Invalid task manager response : missing fields.');
$this->sut->notify(Notifier::MESSAGE_CREATE);
}
示例2: testShouldAcceptOnlyREQSockets
/**
* @test should accept only REQ sockets
*/
public function testShouldAcceptOnlyREQSockets()
{
$this->socket = $this->getMockBuilder('\\ZMQSocket')->disableOriginalConstructor()->getMock();
$this->socket->expects($this->any())->method('getSocketType')->will($this->returnValue(\ZMQ::SOCKET_PUSH));
$this->setExpectedException('\\InvalidArgumentException', 'Invalid socket type');
new ZeroMQClientTransport($this->socket);
}
示例3: testZeroMQExceptionsThrownDuringReceivingRequestShouldBeConvertedToTransportException
public function testZeroMQExceptionsThrownDuringReceivingRequestShouldBeConvertedToTransportException()
{
$exception = new \ZMQSocketException('Cannot receive data');
$this->socket->expects($this->once())->method('recvMulti')->will($this->throwException($exception));
$this->setExpectedException('Wookieb\\ZorroRPC\\Exception\\TransportException', 'Unable to receive request');
try {
$this->object->receiveRequest();
} catch (TransportException $e) {
$this->assertSame($exception, $e->getPrevious());
throw $e;
}
}