public function testBatchingRequests()
 {
     // Test that operations that do not allow 'batching'
     $response = $this->client->import(['batch' => [['event' => 'foo', 'properties' => ['bar' => 'baz']]]]);
     $this->assertEquals(['success' => true], $response);
     // Test that operations that allow 'batching'
     $response = $this->client->track(['event' => 'foo', 'properties' => ['bar' => 'baz']]);
     $this->assertEquals(['success' => true, 'batched' => true], $response);
 }
 /**
  * Flushes the queue by batching Import operations
  *
  * @return boolean
  */
 public function flush()
 {
     if (empty($this->queue)) {
         return false;
     }
     $operations = array_chunk($this->queue, $this->batchSize);
     foreach ($operations as $batch) {
         $this->client->import(['batch' => $batch]);
     }
     return true;
 }