diff --git a/src/Address/GeopuntAddressParser.php b/src/Address/GeopuntAddressParser.php index 6fb2d67a96..39501ef0e6 100644 --- a/src/Address/GeopuntAddressParser.php +++ b/src/Address/GeopuntAddressParser.php @@ -24,7 +24,7 @@ final class GeopuntAddressParser implements AddressParser, LoggerAwareInterface public function __construct( ?ClientInterface $httpClient = null, - ?string $apiUrlV4 = 'https://loc.geopunt.be/v4' + ?string $apiUrlV4 = 'https://geo.api.vlaanderen.be/geolocation/v4' ) { $this->httpClient = $httpClient ?? new Client(); $this->apiUrlV4 = new Uri(rtrim($apiUrlV4, '/')); diff --git a/tests/Address/GeopuntAddressParserTest.php b/tests/Address/GeopuntAddressParserTest.php index 9dfb2861b5..2657dcdabe 100644 --- a/tests/Address/GeopuntAddressParserTest.php +++ b/tests/Address/GeopuntAddressParserTest.php @@ -40,7 +40,7 @@ public function it_looks_up_the_given_address_in_the_geopunt_api_and_returns_a_p $expectedRequest = new Request( 'GET', - 'https://loc.geopunt.be/v4/Location?q=Martelarenplein%201,%203000%20Leuven,%20BE' + 'https://geo.api.vlaanderen.be/geolocation/v4/Location?q=Martelarenplein%201,%203000%20Leuven,%20BE' ); $mockResponseData = [ @@ -67,7 +67,7 @@ public function it_looks_up_the_given_address_in_the_geopunt_api_and_returns_a_p 'Leuven' ); - $this->expectedLogs->info('GET https://loc.geopunt.be/v4/Location?q=Martelarenplein%201,%203000%20Leuven,%20BE responded with status code 200 and body {"LocationResult":[{"Municipality":"Leuven","Zipcode":"3000","Thoroughfarename":"Martelarenplein","Housenumber":"12"}]}'); + $this->expectedLogs->info('GET https://geo.api.vlaanderen.be/geolocation/v4/Location?q=Martelarenplein%201,%203000%20Leuven,%20BE responded with status code 200 and body {"LocationResult":[{"Municipality":"Leuven","Zipcode":"3000","Thoroughfarename":"Martelarenplein","Housenumber":"12"}]}'); $this->expectedLogs->info('Successfully parsed response body.'); $actualParsedAddress = $this->geopuntAddressParser->parse($address); @@ -85,7 +85,7 @@ public function it_can_handle_housenumber_being_null(): void $expectedRequest = new Request( 'GET', - 'https://loc.geopunt.be/v4/Location?q=Martelarenplein%201,%203000%20Leuven,%20BE' + 'https://geo.api.vlaanderen.be/geolocation/v4/Location?q=Martelarenplein%201,%203000%20Leuven,%20BE' ); $mockResponseData = [ @@ -112,7 +112,7 @@ public function it_can_handle_housenumber_being_null(): void 'Leuven' ); - $this->expectedLogs->info('GET https://loc.geopunt.be/v4/Location?q=Martelarenplein%201,%203000%20Leuven,%20BE responded with status code 200 and body {"LocationResult":[{"Municipality":"Leuven","Zipcode":"3000","Thoroughfarename":"Martelarenplein","Housenumber":null}]}'); + $this->expectedLogs->info('GET https://geo.api.vlaanderen.be/geolocation/v4/Location?q=Martelarenplein%201,%203000%20Leuven,%20BE responded with status code 200 and body {"LocationResult":[{"Municipality":"Leuven","Zipcode":"3000","Thoroughfarename":"Martelarenplein","Housenumber":null}]}'); $this->expectedLogs->info('Successfully parsed response body.'); $actualParsedAddress = $this->geopuntAddressParser->parse($address); @@ -130,7 +130,7 @@ public function it_can_handle_json_syntax_errors(): void $expectedRequest = new Request( 'GET', - 'https://loc.geopunt.be/v4/Location?q=Martelarenplein%201,%203000%20Leuven,%20BE' + 'https://geo.api.vlaanderen.be/geolocation/v4/Location?q=Martelarenplein%201,%203000%20Leuven,%20BE' ); $mockResponse = new Response(200, [], '{{}'); @@ -140,7 +140,7 @@ public function it_can_handle_json_syntax_errors(): void ->with($expectedRequest) ->willReturn($mockResponse); - $this->expectedLogs->info('GET https://loc.geopunt.be/v4/Location?q=Martelarenplein%201,%203000%20Leuven,%20BE responded with status code 200 and body {{}'); + $this->expectedLogs->info('GET https://geo.api.vlaanderen.be/geolocation/v4/Location?q=Martelarenplein%201,%203000%20Leuven,%20BE responded with status code 200 and body {{}'); $this->expectedLogs->error('Caught \JsonException while decoding response body.', ['message' => 'Syntax error']); $actualParsedAddress = $this->geopuntAddressParser->parse($address); @@ -158,7 +158,7 @@ public function it_can_handle_missing_LocationResult_property(): void $expectedRequest = new Request( 'GET', - 'https://loc.geopunt.be/v4/Location?q=Martelarenplein%201,%203000%20Leuven,%20BE' + 'https://geo.api.vlaanderen.be/geolocation/v4/Location?q=Martelarenplein%201,%203000%20Leuven,%20BE' ); $mockResponse = new Response(200, [], '{}'); @@ -168,7 +168,7 @@ public function it_can_handle_missing_LocationResult_property(): void ->with($expectedRequest) ->willReturn($mockResponse); - $this->expectedLogs->info('GET https://loc.geopunt.be/v4/Location?q=Martelarenplein%201,%203000%20Leuven,%20BE responded with status code 200 and body {}'); + $this->expectedLogs->info('GET https://geo.api.vlaanderen.be/geolocation/v4/Location?q=Martelarenplein%201,%203000%20Leuven,%20BE responded with status code 200 and body {}'); $this->expectedLogs->error( 'Response body did not match the expected JSON schema. Did the API introduce a breaking change?', [ @@ -195,7 +195,7 @@ public function it_can_handle_missing_properties_inside_LocationResult(): void $expectedRequest = new Request( 'GET', - 'https://loc.geopunt.be/v4/Location?q=Martelarenplein%201,%203000%20Leuven,%20BE' + 'https://geo.api.vlaanderen.be/geolocation/v4/Location?q=Martelarenplein%201,%203000%20Leuven,%20BE' ); $mockResponseData = [ @@ -210,7 +210,7 @@ public function it_can_handle_missing_properties_inside_LocationResult(): void ->with($expectedRequest) ->willReturn($mockResponse); - $this->expectedLogs->info('GET https://loc.geopunt.be/v4/Location?q=Martelarenplein%201,%203000%20Leuven,%20BE responded with status code 200 and body {"LocationResult":[{}]}'); + $this->expectedLogs->info('GET https://geo.api.vlaanderen.be/geolocation/v4/Location?q=Martelarenplein%201,%203000%20Leuven,%20BE responded with status code 200 and body {"LocationResult":[{}]}'); $this->expectedLogs->error( 'Response body did not match the expected JSON schema. Did the API introduce a breaking change?', [ @@ -237,7 +237,7 @@ public function it_can_handle_incorrect_property_values_inside_LocationResult(): $expectedRequest = new Request( 'GET', - 'https://loc.geopunt.be/v4/Location?q=Martelarenplein%201,%203000%20Leuven,%20BE' + 'https://geo.api.vlaanderen.be/geolocation/v4/Location?q=Martelarenplein%201,%203000%20Leuven,%20BE' ); $mockResponseData = [ @@ -257,7 +257,7 @@ public function it_can_handle_incorrect_property_values_inside_LocationResult(): ->with($expectedRequest) ->willReturn($mockResponse); - $this->expectedLogs->info('GET https://loc.geopunt.be/v4/Location?q=Martelarenplein%201,%203000%20Leuven,%20BE responded with status code 200 and body {"LocationResult":[{"Municipality":8,"Zipcode":null,"Thoroughfarename":false,"Housenumber":[]}]}'); + $this->expectedLogs->info('GET https://geo.api.vlaanderen.be/geolocation/v4/Location?q=Martelarenplein%201,%203000%20Leuven,%20BE responded with status code 200 and body {"LocationResult":[{"Municipality":8,"Zipcode":null,"Thoroughfarename":false,"Housenumber":[]}]}'); $this->expectedLogs->error( 'Response body did not match the expected JSON schema. Did the API introduce a breaking change?', [ @@ -292,7 +292,7 @@ public function it_can_handle_an_empty_LocationResult(): void $expectedRequest = new Request( 'GET', - 'https://loc.geopunt.be/v4/Location?q=Martelarenplein%201,%203000%20Leuven,%20BE' + 'https://geo.api.vlaanderen.be/geolocation/v4/Location?q=Martelarenplein%201,%203000%20Leuven,%20BE' ); $mockResponseData = [ @@ -305,7 +305,7 @@ public function it_can_handle_an_empty_LocationResult(): void ->with($expectedRequest) ->willReturn($mockResponse); - $this->expectedLogs->info('GET https://loc.geopunt.be/v4/Location?q=Martelarenplein%201,%203000%20Leuven,%20BE responded with status code 200 and body {"LocationResult":[]}'); + $this->expectedLogs->info('GET https://geo.api.vlaanderen.be/geolocation/v4/Location?q=Martelarenplein%201,%203000%20Leuven,%20BE responded with status code 200 and body {"LocationResult":[]}'); $this->expectedLogs->info('Response body did not contain any array items inside "LocationResult" property. Either the address is not located in Belgium, or it is not recognized as an official address.'); $actualParsedAddress = $this->geopuntAddressParser->parse($address); @@ -323,7 +323,7 @@ public function it_can_handle_an_empty_zipcode(): void $expectedRequest = new Request( 'GET', - 'https://loc.geopunt.be/v4/Location?q=Marguerite%20Durassquare,%201000%20Brussel,%20BE' + 'https://geo.api.vlaanderen.be/geolocation/v4/Location?q=Marguerite%20Durassquare,%201000%20Brussel,%20BE' ); $mockResponseData = [ @@ -344,7 +344,7 @@ public function it_can_handle_an_empty_zipcode(): void ->with($expectedRequest) ->willReturn($mockResponse); - $this->expectedLogs->info('GET https://loc.geopunt.be/v4/Location?q=Marguerite%20Durassquare,%201000%20Brussel,%20BE responded with status code 200 and body {"LocationResult":[{"Municipality":"Bruxelles","Zipcode":null,"Thoroughfarename":"Marguerite Durassquare","Housenumber":null}]}'); + $this->expectedLogs->info('GET https://geo.api.vlaanderen.be/geolocation/v4/Location?q=Marguerite%20Durassquare,%201000%20Brussel,%20BE responded with status code 200 and body {"LocationResult":[{"Municipality":"Bruxelles","Zipcode":null,"Thoroughfarename":"Marguerite Durassquare","Housenumber":null}]}'); $this->expectedLogs->info('Successfully parsed response body.'); $expectedParsedAddress = new ParsedAddress( @@ -369,7 +369,7 @@ public function it_can_handle_an_empty_thoroughfare(): void $expectedRequest = new Request( 'GET', - 'https://loc.geopunt.be/v4/Location?q=Marguerite%20Durassquare,%201000%20Brussel,%20BE' + 'https://geo.api.vlaanderen.be/geolocation/v4/Location?q=Marguerite%20Durassquare,%201000%20Brussel,%20BE' ); $mockResponseData = [ @@ -390,7 +390,7 @@ public function it_can_handle_an_empty_thoroughfare(): void ->with($expectedRequest) ->willReturn($mockResponse); - $this->expectedLogs->info('GET https://loc.geopunt.be/v4/Location?q=Marguerite%20Durassquare,%201000%20Brussel,%20BE responded with status code 200 and body {"LocationResult":[{"Municipality":"Bruxelles","Zipcode":"1000","Thoroughfarename":null,"Housenumber":null}]}'); + $this->expectedLogs->info('GET https://geo.api.vlaanderen.be/geolocation/v4/Location?q=Marguerite%20Durassquare,%201000%20Brussel,%20BE responded with status code 200 and body {"LocationResult":[{"Municipality":"Bruxelles","Zipcode":"1000","Thoroughfarename":null,"Housenumber":null}]}'); $this->expectedLogs->info('Successfully parsed response body.'); $expectedParsedAddress = new ParsedAddress(