/** * @dataProvider queueIdProvider * * @param $existingQueueId */ public function testPullSocketIsSetup($existingQueueId) { $queueId = "queueId"; $endpoints = ["bind" => [], "connect" => []]; if (!empty($existingQueueId)) { $endpoints["bind"][] = $existingQueueId; } $queueIdIsDifferent = $existingQueueId != $queueId; $this->socket->shouldReceive("setsockopt"); $this->socket->shouldReceive("getendpoints")->andReturn($endpoints); $this->socket->shouldReceive("bind")->times(1 + (int) $queueIdIsDifferent); $this->socket->shouldReceive("recv")->twice(); if ($queueIdIsDifferent) { $this->socket->shouldReceive("unbind")->withArgs([$existingQueueId])->atLeast()->once(); } $queue = new Queue($this->context, $this->messageFactory); $queue->receiveMessage($existingQueueId); $queue->receiveMessage($queueId); }