public function testEnsureNonJsonIsntCached() { $pp = new PP('http://example.com'); $pp->with_cache('file')->directory(static::$cache_directory); $pp->prepare(); // Simulate the events for the cache object. $request = new Request('GET', 'http://foo.com'); $response = new Response(200, array(), 'Foo'); // Fake the request. $pp->cache_plugin->onRequestBeforeSend(new Event(array('request' => $request))); // Fake the response to that request. $pp->cache_plugin->onRequestSent(new Event(array('request' => $request, 'response' => $response))); $key_provider = new \Guzzle\Plugin\Cache\DefaultCacheKeyProvider(); $data = $pp->cache_object->fetch($key_provider->getCacheKey($request)); $this->assertEmpty($data, "Non json responses should not be cached."); }