@@ -25,9 +25,8 @@ public function should_return_valid_location()
25
25
$ cacheMock = Mockery::mock (CacheManager::class)
26
26
->shouldAllowMockingProtectedMethods ();
27
27
28
- $ cacheMock ->shouldReceive ('get ' )
29
- ->with ($ data ['ip ' ])
30
- ->andReturn ($ data );
28
+ $ cacheMock ->shouldReceive ('supportsTags ' )->andReturn (false );
29
+ $ cacheMock ->shouldReceive ('get ' )->with ($ data ['ip ' ])->andReturn ($ data );
31
30
32
31
$ geo_ip = $ this ->makeGeoIP ([], $ cacheMock );
33
32
$ geo_ip ->getCache ()->setPrefix ('' );
@@ -45,16 +44,12 @@ public function should_return_invalid_location()
45
44
$ cacheMock = Mockery::mock (CacheManager::class)
46
45
->shouldAllowMockingProtectedMethods ();
47
46
47
+ $ cacheMock ->shouldReceive ('supportsTags ' )->andReturn (false );
48
+
48
49
$ geo_ip = $ this ->makeGeoIP ([], $ cacheMock );
49
50
$ geo_ip ->getCache ()->setPrefix ('' );
50
51
51
- $ cacheMock ->shouldReceive ('get ' )
52
- ->with ('81.2.69.142 ' )
53
- ->andReturn (null );
54
-
55
- $ cacheMock ->shouldReceive ('tags ' )
56
- ->with ($ geo_ip ->config ('cache_tags ' ))
57
- ->andReturnSelf ();
52
+ $ cacheMock ->shouldReceive ('get ' )->with ('81.2.69.142 ' )->andReturn (null );
58
53
59
54
$ this ->assertSame ($ geo_ip ->getCache ()->get ('81.2.69.142 ' ), null );
60
55
}
@@ -72,12 +67,12 @@ public function should_set_location()
72
67
$ cacheMock = Mockery::mock (CacheManager::class)
73
68
->shouldAllowMockingProtectedMethods ();
74
69
70
+ $ cacheMock ->shouldReceive ('supportsTags ' )->andReturn (false );
71
+
75
72
$ geo_ip = $ this ->makeGeoIP ([], $ cacheMock );
76
73
$ geo_ip ->getCache ()->setPrefix ('' );
77
74
78
- $ cacheMock ->shouldReceive ('put ' )
79
- ->withArgs (['81.2.69.142 ' , $ location ->toArray (), $ geo_ip ->config ('cache_expires ' )])
80
- ->andReturn (null );
75
+ $ cacheMock ->shouldReceive ('put ' )->withArgs (['81.2.69.142 ' , $ location ->toArray (), $ geo_ip ->config ('cache_expires ' )])->andReturn (null );
81
76
82
77
$ cacheMock ->shouldReceive ('tags ' )
83
78
->with ($ geo_ip ->config ('cache_tags ' ))
@@ -94,12 +89,10 @@ public function should_flush_locations()
94
89
95
90
$ geo_ip = $ this ->makeGeoIP ([], $ cacheMock );
96
91
97
- $ cacheMock ->shouldReceive ('flush ' )
98
- ->andReturn (true );
92
+ $ cacheMock ->shouldReceive ('flush ' )->andReturn (true );
99
93
100
- $ cacheMock ->shouldReceive ('tags ' )
101
- ->with ($ geo_ip ->config ('cache_tags ' ))
102
- ->andReturnSelf ();
94
+ $ cacheMock ->shouldReceive ('tags ' )->with ($ geo_ip ->config ('cache_tags ' ))->andReturnSelf ();
95
+ $ cacheMock ->shouldReceive ('tags ' )->with ($ geo_ip ->config ('cache_tags ' ))->andReturnSelf ();
103
96
104
97
$ this ->assertSame ($ geo_ip ->getCache ()->flush (), true );
105
98
}
0 commit comments