@@ -14,6 +14,7 @@ public function testGetGeocodedData()
14
14
{
15
15
$ address = 'Paris, France ' ;
16
16
$ coordinates = array ('lat ' => 48.857049 ,'lng ' => 2.35223 );
17
+ $ cacheKey = 'geocoder_ ' . sha1 ($ address );
17
18
18
19
$ delegate = $ this ->getMock ('Geocoder \\Provider \\ProviderInterface ' );
19
20
$ delegate ->expects ($ this ->once ())
@@ -24,12 +25,12 @@ public function testGetGeocodedData()
24
25
$ cache = $ this ->getMock ('Doctrine \\Common \\Cache \\Cache ' );
25
26
$ cache ->expects ($ this ->once ())
26
27
->method ('fetch ' )
27
- ->with (crc32 ( $ address ) )
28
+ ->with ($ cacheKey )
28
29
->will ($ this ->returnValue (false ));
29
30
30
31
$ cache ->expects ($ this ->once ())
31
32
->method ('save ' )
32
- ->with (crc32 ( $ address ) , serialize ($ coordinates ), 0 );
33
+ ->with ($ cacheKey , serialize ($ coordinates ), 0 );
33
34
34
35
$ provider = new CacheProvider ($ cache , $ delegate );
35
36
$ this ->assertEquals ($ coordinates , $ provider ->getGeocodedData ($ address ));
@@ -39,6 +40,7 @@ public function testGetCachedGeocodedData()
39
40
{
40
41
$ address = 'Paris, France ' ;
41
42
$ coordinates = array ('lat ' => 48.857049 ,'lng ' => 2.35223 );
43
+ $ cacheKey = 'geocoder_ ' . sha1 ($ address );
42
44
43
45
$ delegate = $ this ->getMock ('Geocoder \\Provider \\ProviderInterface ' );
44
46
$ delegate ->expects ($ this ->once ())
@@ -51,7 +53,7 @@ public function testGetCachedGeocodedData()
51
53
$ provider ->getGeocodedData ($ address );
52
54
$ provider ->getGeocodedData ($ address );
53
55
54
- $ this ->assertTrue ($ cache ->contains (crc32 ( $ address ) ));
56
+ $ this ->assertTrue ($ cache ->contains ($ cacheKey ));
55
57
}
56
58
57
59
public function testGetReversedData ()
0 commit comments