public function testDataReturnsBodyEvenIfBadRequestException()
 {
     $guzzle = $this->guzzle();
     $guzzle->method('send')->willThrowException(new BadResponseException('test exception', $this->request(), $this->response('body with exception')));
     $cache = $this->cache();
     $provider = new ProxyDataProvider($guzzle, $cache);
     $request = $this->request('/api/some/url');
     $data = $provider->data($request);
     $this->assertEquals('body with exception', $data);
 }
 public function testDifferentCacheForDifferentRequests()
 {
     $guzzle = $this->guzzle(['/api/some/url' => 'api/some/url content', '/api/another/url' => 'api/another/url content']);
     $cache = new ArrayCache();
     $provider = new ProxyDataProvider($guzzle, $cache);
     // first request
     $request = $this->request('/api/some/url');
     $provider->data($request);
     // second request
     $request = $this->request('/api/another/url');
     $provider->data($request);
     // get data from cache
     // first
     $request = $this->request('/api/some/url');
     $first = $provider->data($request);
     // second request
     $request = $this->request('/api/another/url');
     $second = $provider->data($request);
     $this->assertEquals('api/some/url content', $first);
     $this->assertEquals('api/another/url content', $second);
 }