File tree Expand file tree Collapse file tree 3 files changed +19
-26
lines changed Expand file tree Collapse file tree 3 files changed +19
-26
lines changed Original file line number Diff line number Diff line change @@ -86,9 +86,7 @@ public function testIpAddressIsPassedCorrectToReader(string $geoIp2Model): void
86
86
->expects ($ this ->once ())
87
87
->method ($ geoIp2Model )
88
88
->with ('127.0.0.1 ' )
89
- ->will ($ this ->returnValue (
90
- $ this ->getGeoIP2ModelMock ($ geoIp2Model )
91
- ));
89
+ ->willReturn ($ this ->getGeoIP2ModelMock ($ geoIp2Model ));
92
90
93
91
$ adapter = new GeoIP2Adapter ($ geoIp2Provider , $ geoIp2Model );
94
92
$ adapter ->getContent ('file://geoip?127.0.0.1 ' );
@@ -110,15 +108,15 @@ public function testReaderResponseIsJsonEncoded(): void
110
108
$ geoIp2Provider
111
109
->expects ($ this ->any ())
112
110
->method ('city ' )
113
- ->will ( $ this -> returnValue ( $ cityModel) );
111
+ ->willReturn ( $ cityModel );
114
112
115
113
$ adapter = new GeoIP2Adapter ($ geoIp2Provider );
116
114
117
115
$ result = $ adapter ->getContent ('file://database?127.0.0.1 ' );
118
116
$ this ->assertJson ($ result );
119
117
120
118
$ decodedResult = json_decode ($ result );
121
- $ this ->assertObjectHasAttribute ('city ' , $ decodedResult );
119
+ $ this ->assertObjectHasProperty ('city ' , $ decodedResult );
122
120
}
123
121
124
122
/**
@@ -145,23 +143,21 @@ protected function getGeoIP2ModelMock($geoIP2Model)
145
143
$ mock
146
144
->expects ($ this ->any ())
147
145
->method ('jsonSerialize ' )
148
- ->will ($ this ->returnValue (
149
- [
150
- 'city ' => [
151
- 'geoname_id ' => 2911298 ,
152
- 'names ' => [
153
- 'de ' => 'Hamburg ' ,
154
- 'en ' => 'Hamburg ' ,
155
- 'es ' => 'Hamburgo ' ,
156
- 'fr ' => 'Hambourg ' ,
157
- 'ja ' => 'ハンブルク ' ,
158
- 'pt-BR ' => 'Hamburgo ' ,
159
- 'ru ' => 'Гамбург ' ,
160
- 'zh-CN ' => '汉堡市 ' ,
161
- ],
146
+ ->willReturn ([
147
+ 'city ' => [
148
+ 'geoname_id ' => 2911298 ,
149
+ 'names ' => [
150
+ 'de ' => 'Hamburg ' ,
151
+ 'en ' => 'Hamburg ' ,
152
+ 'es ' => 'Hamburgo ' ,
153
+ 'fr ' => 'Hambourg ' ,
154
+ 'ja ' => 'ハンブルク ' ,
155
+ 'pt-BR ' => 'Hamburgo ' ,
156
+ 'ru ' => 'Гамбург ' ,
157
+ 'zh-CN ' => '汉堡市 ' ,
162
158
],
163
- ]
164
- ) );
159
+ ],
160
+ ] );
165
161
166
162
return $ mock ;
167
163
}
Original file line number Diff line number Diff line change @@ -264,10 +264,7 @@ public static function provideDataForTestingExceptions(): array
264
264
*/
265
265
private function getGeoIP2AdapterMock ($ returnValue = '' )
266
266
{
267
- $ mock = $ this ->getMockBuilder (GeoIP2Adapter::class)
268
- ->disableOriginalConstructor ()
269
- ->setMethods (['getContent ' ])
270
- ->getMock ();
267
+ $ mock = $ this ->createPartialMock (GeoIP2Adapter::class, ['getContent ' ]);
271
268
272
269
if ($ returnValue instanceof \Exception) {
273
270
$ returnValue = $ this ->throwException ($ returnValue );
Original file line number Diff line number Diff line change 21
21
},
22
22
"require-dev" : {
23
23
"geocoder-php/provider-integration-tests" : " ^1.6.3" ,
24
- "phpunit/phpunit" : " ^9.5 "
24
+ "phpunit/phpunit" : " ^9.6.11 "
25
25
},
26
26
"extra" : {
27
27
"branch-alias" : {
You can’t perform that action at this time.
0 commit comments