@@ -22,7 +22,7 @@ final class MapboxTest extends TestCase
22
22
{
23
23
public function testGeocodeWithSingleResult ()
24
24
{
25
- $ result = $ this -> jsonMockResponseFromFile (__DIR__ .'/fixtures/mapbox-geocode-single.json ' );
25
+ $ result = JsonMockResponse:: fromFile (__DIR__ .'/fixtures/mapbox-geocode-single.json ' );
26
26
$ httpClient = new MockHttpClient ($ result );
27
27
28
28
$ mapbox = new Mapbox ($ httpClient , 'test_token ' );
@@ -48,7 +48,7 @@ public function testGeocodeWithSingleResult()
48
48
49
49
public function testGeocodeWithMultipleResults ()
50
50
{
51
- $ result = $ this -> jsonMockResponseFromFile (__DIR__ .'/fixtures/mapbox-geocode-multiple.json ' );
51
+ $ result = JsonMockResponse:: fromFile (__DIR__ .'/fixtures/mapbox-geocode-multiple.json ' );
52
52
$ httpClient = new MockHttpClient ($ result );
53
53
54
54
$ mapbox = new Mapbox ($ httpClient , 'test_token ' );
@@ -83,7 +83,7 @@ public function testGeocodeWithMultipleResults()
83
83
84
84
public function testGeocodeWithNoResults ()
85
85
{
86
- $ result = $ this -> jsonMockResponseFromFile (__DIR__ .'/fixtures/mapbox-geocode-empty.json ' );
86
+ $ result = JsonMockResponse:: fromFile (__DIR__ .'/fixtures/mapbox-geocode-empty.json ' );
87
87
$ httpClient = new MockHttpClient ($ result );
88
88
89
89
$ mapbox = new Mapbox ($ httpClient , 'test_token ' );
@@ -99,7 +99,7 @@ public function testGeocodeWithNoResults()
99
99
100
100
public function testReverseGeocodeWithValidCoordinates ()
101
101
{
102
- $ result = $ this -> jsonMockResponseFromFile (__DIR__ .'/fixtures/mapbox-reverse-geocode.json ' );
102
+ $ result = JsonMockResponse:: fromFile (__DIR__ .'/fixtures/mapbox-reverse-geocode.json ' );
103
103
$ httpClient = new MockHttpClient ($ result );
104
104
105
105
$ mapbox = new Mapbox ($ httpClient , 'test_token ' );
@@ -141,7 +141,7 @@ public function testReverseGeocodeWithValidCoordinates()
141
141
142
142
public function testReverseGeocodeWithNoResults ()
143
143
{
144
- $ result = $ this -> jsonMockResponseFromFile (__DIR__ .'/fixtures/mapbox-reverse-geocode-empty.json ' );
144
+ $ result = JsonMockResponse:: fromFile (__DIR__ .'/fixtures/mapbox-reverse-geocode-empty.json ' );
145
145
$ httpClient = new MockHttpClient ($ result );
146
146
147
147
$ mapbox = new Mapbox ($ httpClient , 'test_token ' );
@@ -154,12 +154,4 @@ public function testReverseGeocodeWithNoResults()
154
154
155
155
$ this ->assertEquals ($ expected , $ actual );
156
156
}
157
-
158
- /**
159
- * This can be replaced by `JsonMockResponse::fromFile` when dropping Symfony 6.4.
160
- */
161
- private function jsonMockResponseFromFile (string $ file ): JsonMockResponse
162
- {
163
- return new JsonMockResponse (json_decode (file_get_contents ($ file ), true ));
164
- }
165
157
}
0 commit comments