@@ -22,7 +22,7 @@ final class MapboxTest extends TestCase
2222{
2323 public function testGeocodeWithSingleResult ()
2424 {
25- $ result = $ this -> jsonMockResponseFromFile (__DIR__ .'/fixtures/mapbox-geocode-single.json ' );
25+ $ result = JsonMockResponse:: fromFile (__DIR__ .'/fixtures/mapbox-geocode-single.json ' );
2626 $ httpClient = new MockHttpClient ($ result );
2727
2828 $ mapbox = new Mapbox ($ httpClient , 'test_token ' );
@@ -48,7 +48,7 @@ public function testGeocodeWithSingleResult()
4848
4949 public function testGeocodeWithMultipleResults ()
5050 {
51- $ result = $ this -> jsonMockResponseFromFile (__DIR__ .'/fixtures/mapbox-geocode-multiple.json ' );
51+ $ result = JsonMockResponse:: fromFile (__DIR__ .'/fixtures/mapbox-geocode-multiple.json ' );
5252 $ httpClient = new MockHttpClient ($ result );
5353
5454 $ mapbox = new Mapbox ($ httpClient , 'test_token ' );
@@ -83,7 +83,7 @@ public function testGeocodeWithMultipleResults()
8383
8484 public function testGeocodeWithNoResults ()
8585 {
86- $ result = $ this -> jsonMockResponseFromFile (__DIR__ .'/fixtures/mapbox-geocode-empty.json ' );
86+ $ result = JsonMockResponse:: fromFile (__DIR__ .'/fixtures/mapbox-geocode-empty.json ' );
8787 $ httpClient = new MockHttpClient ($ result );
8888
8989 $ mapbox = new Mapbox ($ httpClient , 'test_token ' );
@@ -99,7 +99,7 @@ public function testGeocodeWithNoResults()
9999
100100 public function testReverseGeocodeWithValidCoordinates ()
101101 {
102- $ result = $ this -> jsonMockResponseFromFile (__DIR__ .'/fixtures/mapbox-reverse-geocode.json ' );
102+ $ result = JsonMockResponse:: fromFile (__DIR__ .'/fixtures/mapbox-reverse-geocode.json ' );
103103 $ httpClient = new MockHttpClient ($ result );
104104
105105 $ mapbox = new Mapbox ($ httpClient , 'test_token ' );
@@ -141,7 +141,7 @@ public function testReverseGeocodeWithValidCoordinates()
141141
142142 public function testReverseGeocodeWithNoResults ()
143143 {
144- $ result = $ this -> jsonMockResponseFromFile (__DIR__ .'/fixtures/mapbox-reverse-geocode-empty.json ' );
144+ $ result = JsonMockResponse:: fromFile (__DIR__ .'/fixtures/mapbox-reverse-geocode-empty.json ' );
145145 $ httpClient = new MockHttpClient ($ result );
146146
147147 $ mapbox = new Mapbox ($ httpClient , 'test_token ' );
@@ -154,12 +154,4 @@ public function testReverseGeocodeWithNoResults()
154154
155155 $ this ->assertEquals ($ expected , $ actual );
156156 }
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- }
165157}
0 commit comments