コード例 #1
0
 public function test_process_ShouldWriteRequestsToQueue()
 {
     $this->assertSame(0, $this->queue->getNumberOfRequestSetsInAllQueues());
     $this->processDummyRequests();
     $this->assertSame(1, $this->queue->getNumberOfRequestSetsInAllQueues());
     $this->processDummyRequests();
     $this->assertSame(2, $this->queue->getNumberOfRequestSetsInAllQueues());
     // verify
     $this->queue->setNumberOfRequestsToProcessAtSameTime(2);
     // those requests  will be written into queue 1
     $requestSet = $this->queue->createQueue($id = 1)->getRequestSetsToProcess();
     $this->assertCount(2, $requestSet);
     $requests = $requestSet[0]->getRequests();
     $this->assertCount(2, $requests);
     $ip = '192.168.33.11';
     $defaultRequest = array('idsite' => 1, 'cip' => $ip, 'token_auth' => Fixture::getTokenAuth());
     $this->assertEquals(array_merge(array('url' => 'http://localhost/foo?bar'), $defaultRequest), $requests[0]->getParams());
     $this->assertEquals(array_merge(array('url' => 'http://localhost'), $defaultRequest), $requests[1]->getParams());
 }