public function testFetchesNewTokenIfExpired()
 {
     $this->mockResolver->shouldReceive('getToken')->once();
     //should use cached token
     $resolver = new RequestHandler($this->mockResolver);
     $resolver->read("test.com");
 }
 /**
  * @param RequestHandler $gateway
  * @param                $url
  * @param array          $params
  *
  * @return string
  * @throws \Exception
  */
 public function fetchIncrement(RequestHandler $gateway, $url, $params = array())
 {
     if (!isset($params['offset'])) {
         throw new \InvalidArgumentException("missing offset value");
     }
     $request = $gateway->read($url, $params, true);
     $this->validate($request);
     static::$total = $this->getTotalDataCount($request);
     $this->reset();
     return $request['body'];
 }