22
33namespace InteractionDesignFoundation \GeoIP \Tests ;
44
5+ use Illuminate \Cache \CacheManager ;
56use Mockery ;
67
78class CacheTest extends TestCase
89{
9- /**
10- * @test
11- */
10+ /** @test */
1211 public function shouldReturnValidLocation ()
1312 {
1413 $ data = [
@@ -18,14 +17,15 @@ public function shouldReturnValidLocation()
1817 'lon ' => -72.92 ,
1918 ];
2019
21- $ cacheMock = Mockery::mock (' Illuminate\Cache\ CacheManager' )
20+ $ cacheMock = Mockery::mock (CacheManager::class )
2221 ->shouldAllowMockingProtectedMethods ();
2322
2423 $ cacheMock ->shouldReceive ('get ' )
2524 ->with ($ data ['ip ' ])
2625 ->andReturn ($ data );
2726
2827 $ geo_ip = $ this ->makeGeoIP ([], $ cacheMock );
28+ $ geo_ip ->getCache ()->setPrefix ('' );
2929
3030 $ location = $ geo_ip ->getCache ()->get ($ data ['ip ' ]);
3131
@@ -34,15 +34,14 @@ public function shouldReturnValidLocation()
3434 $ this ->assertEquals ($ location ->default , false );
3535 }
3636
37- /**
38- * @test
39- */
37+ /** @test */
4038 public function shouldReturnInvalidLocation ()
4139 {
42- $ cacheMock = Mockery::mock (' Illuminate\Cache\ CacheManager' )
40+ $ cacheMock = Mockery::mock (CacheManager::class )
4341 ->shouldAllowMockingProtectedMethods ();
4442
4543 $ geo_ip = $ this ->makeGeoIP ([], $ cacheMock );
44+ $ geo_ip ->getCache ()->setPrefix ('' );
4645
4746 $ cacheMock ->shouldReceive ('get ' )
4847 ->with ('81.2.69.142 ' )
@@ -55,9 +54,7 @@ public function shouldReturnInvalidLocation()
5554 $ this ->assertEquals ($ geo_ip ->getCache ()->get ('81.2.69.142 ' ), null );
5655 }
5756
58- /**
59- * @test
60- */
57+ /** @test */
6158 public function shouldSetLocation ()
6259 {
6360 $ location = new \InteractionDesignFoundation \GeoIP \Location ([
@@ -67,10 +64,11 @@ public function shouldSetLocation()
6764 'lon ' => -72.92 ,
6865 ]);
6966
70- $ cacheMock = Mockery::mock (' Illuminate\Cache\ CacheManager' )
67+ $ cacheMock = Mockery::mock (CacheManager::class )
7168 ->shouldAllowMockingProtectedMethods ();
7269
7370 $ geo_ip = $ this ->makeGeoIP ([], $ cacheMock );
71+ $ geo_ip ->getCache ()->setPrefix ('' );
7472
7573 $ cacheMock ->shouldReceive ('put ' )
7674 ->withArgs (['81.2.69.142 ' , $ location ->toArray (), $ geo_ip ->config ('cache_expires ' )])
@@ -83,12 +81,10 @@ public function shouldSetLocation()
8381 $ this ->assertEquals ($ geo_ip ->getCache ()->set ('81.2.69.142 ' , $ location ), null );
8482 }
8583
86- /**
87- * @test
88- */
84+ /** @test */
8985 public function shouldFlushLocations ()
9086 {
91- $ cacheMock = Mockery::mock (' Illuminate\Cache\ CacheManager' )
87+ $ cacheMock = Mockery::mock (CacheManager::class )
9288 ->shouldAllowMockingProtectedMethods ();
9389
9490 $ geo_ip = $ this ->makeGeoIP ([], $ cacheMock );
0 commit comments