public function testGetName() { $delegate = $this->getMock('Geocoder\\Provider\\Provider'); $cache = $this->getMock('Doctrine\\Common\\Cache\\Cache'); $provider = new Cache($cache, $delegate); $this->assertEquals('cache', $provider->getName()); }
/** * {@inheritdoc} */ public function reverse($latitude, $longitude) { $key = 'geocoder_' . sha1($this->locale . $latitude . $longitude); if (false !== ($data = $this->cache->fetch($key))) { return unserialize($data); } $data = $this->provider->reverse($latitude, $longitude); $this->cache->save($key, serialize($data), $this->lifetime); return $data; }