Skip to content

Commit

Permalink
Replace cache helper with cache from IOC
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebronner committed Jul 13, 2017
1 parent 9ad3068 commit a322da3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/ProviderAndDumperAggregator.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function dump($dumper)
public function geocode($value)
{
$cacheKey = str_slug(strtolower(urlencode($value)));
$this->results = cache()->remember(
$this->results = app('cache')->remember(
"geocoder-{$cacheKey}",
config('geocoder.cache-duraction', 0),
function () use ($value) {
Expand All @@ -102,7 +102,7 @@ public function get()
public function reverse($latitude, $longitude)
{
$cacheKey = str_slug(strtolower(urlencode("{$latitude}-{$longitude}")));
$this->results = cache()->remember(
$this->results = app('cache')->remember(
"geocoder-{$cacheKey}",
config('geocoder.cache-duraction', 0),
function () use ($latitude, $longitude) {
Expand Down
6 changes: 3 additions & 3 deletions tests/Laravel5_3/Providers/GeocoderServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ public function testCacheIsUsed()
->get();
$cacheKey = str_slug(strtolower(urlencode('1600 Pennsylvania Ave., Washington, DC USA')));

$this->assertEquals($result, cache("geocoder-{$cacheKey}"));
$this->assertTrue(cache()->has("geocoder-{$cacheKey}"));
$this->assertEquals($result, app('cache')->get("geocoder-{$cacheKey}"));
$this->assertTrue(app('cache')->has("geocoder-{$cacheKey}"));
}

public function testJapaneseCharacterGeocoding()
Expand All @@ -192,7 +192,7 @@ public function testJapaneseCharacterGeocoding()
->get();

$this->assertEquals($cacheKey, '108-0075e69db1e4baace983bde6b8afe58cbae6b8afe58d97efbc92e4b881e79baeefbc91efbc96efbc8defbc93');
$this->assertTrue(cache()->has("geocoder-{$cacheKey}"));
$this->assertTrue(app('cache')->has("geocoder-{$cacheKey}"));
}

public function testFailedGeocodingCanBeCaught()
Expand Down

0 comments on commit a322da3

Please sign in to comment.