/**
  * Initiate the transfer process
  *
  * @return array PUT responses
  */
 public function transfer()
 {
     $requests = $this->sendGetRequests();
     $this->readQueue = null;
     foreach ($requests as $key => $request) {
         $this->writeQueue->add($this->createPutRequest($request->getResponse()));
         unset($requests[$key]);
     }
     return $this->writeQueue->flush();
 }
Пример #2
0
 public function testFlushReturnsItems()
 {
     $transfer = $this->getMockTransfer();
     $transfer->expects($this->exactly(2))->method('transfer');
     $divisor = $this->getMockDivisor();
     $divisor->expects($this->once())->method('createBatches')->will($this->returnValue(array(array('foo', 'baz'), array('bar'))));
     $batch = new Batch($transfer, $divisor);
     $batch->add('foo')->add('baz')->add('bar');
     $items = $batch->flush();
     $this->assertEquals(array('foo', 'baz', 'bar'), $items);
 }