/**
  * @covers ::setLimit
  * @covers ::getLimit
  */
 public function testLimit()
 {
     $limit = rand();
     $setterOutput = $this->object->setLimit($limit);
     $this->assertInstanceOf(RangeQuery::class, $setterOutput);
     $this->assertSame($limit, $this->object->getLimit());
 }
 public function executeRangeQuery(RangeQuery $query, $storageName, $key, \Closure $hydrateRow = null)
 {
     $headers = ['Content-Type' => 'application/atom+xml', 'x-ms-date' => $this->now(), 'Content-Length' => 0];
     $filters = ["PartitionKey eq " . $this->quoteFilterValue($query->getPartitionKey())];
     foreach ($query->getConditions() as $condition) {
         if (!in_array($condition[0], ['eq', 'neq', 'le', 'lt', 'ge', 'gt'])) {
             throw new \InvalidArgumentException("Windows Azure Table only supports eq, neq, le, lt, ge, gt as conditions.");
         }
         $filters[] = $key[1] . " " . $condition[0] . " " . $this->quoteFilterValue($condition[1]);
     }
     // TODO: This sucks
     $tableName = $storageName;
     $url = $this->baseUrl . '/' . $tableName . '()?$filter=' . rawurlencode(implode(' ', $filters));
     if ($query->getLimit()) {
         $url .= '&$top=' . $query->getLimit();
     }
     $response = $this->request('GET', $url, '', $headers);
     if ($response->getStatusCode() >= 400) {
         $this->convertResponseToException($response);
     }
     $dom = new \DomDocument('1.0', 'UTF-8');
     $dom->loadXML($response->getBody());
     $xpath = new \DOMXpath($dom);
     $xpath->registerNamespace('d', 'http://schemas.microsoft.com/ado/2007/08/dataservices');
     $xpath->registerNamespace('m', 'http://schemas.microsoft.com/ado/2007/08/dataservices/metadata');
     $xpath->registerNamespace('atom', "http://www.w3.org/2005/Atom");
     $entries = $xpath->evaluate('/atom:feed/atom:entry');
     $results = [];
     foreach ($entries as $entry) {
         $data = $this->createRow($key, $xpath, $entry);
         $results[] = $hydrateRow ? $hydrateRow($data) : $data;
     }
     return $results;
 }