Skip to content

Commit 4310009

Browse files
authored
chore: update geo service tests (#3280)
1 parent aaa9aab commit 4310009

1 file changed

Lines changed: 18 additions & 16 deletions

File tree

tests/Api/Serializer/RestJsonSerializerTest.php

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -497,9 +497,11 @@ public static function rejectsInvalidJsonAsPayloadProvider(): iterable
497497
'invalid continuation byte' => ["\xC3\x28"],
498498
'overlong encoding' => ["\xE2\x28\xA1"],
499499
'invalid UTF-8 in nested array' => [
500-
'users' => [
501-
['name' => "Valid Name"],
502-
['name' => "\xB1\x31"] // invalid UTF-8
500+
[
501+
'users' => [
502+
['name' => "Valid Name"],
503+
['name' => "\xB1\x31"] // invalid UTF-8
504+
]
503505
]
504506
]
505507
];
@@ -577,7 +579,7 @@ public function testGeoServiceEndpointResolution(
577579

578580
$this->assertEquals(
579581
$expected,
580-
(string) $request->getUri(),
582+
$request->getRequestTarget(),
581583
"Geo Service - {$description}"
582584
);
583585
}
@@ -600,7 +602,7 @@ public function testGeoServiceEndpointV2Resolution(
600602

601603
$this->assertEquals(
602604
$expected,
603-
(string) $request->getUri(),
605+
$request->getRequestTarget(),
604606
"Geo Service V2 - {$description}"
605607
);
606608
}
@@ -804,39 +806,39 @@ public static function geoServiceEndpointResolutionProvider(): \Generator
804806
'endpoint' => 'https://places.geo.region.amazonaws.com/v2',
805807
'requestUri' => '/place/{PlaceId}',
806808
'pathParams' => ['PlaceId' => 'test-place-id'],
807-
'expected' => 'https://places.geo.region.amazonaws.com/v2/place/test-place-id',
809+
'expected' => '/v2/place/test-place-id',
808810
'description' => 'Geo service with /v2 path'
809811
];
810812

811813
yield 'geo_places_v2_trailing_slash' => [
812814
'endpoint' => 'https://places.geo.region.amazonaws.com/v2/',
813815
'requestUri' => '/place/{PlaceId}',
814816
'pathParams' => ['PlaceId' => 'test-place-id'],
815-
'expected' => 'https://places.geo.region.amazonaws.com/v2/place/test-place-id',
817+
'expected' => '/v2/place/test-place-id',
816818
'description' => 'Geo service with /v2/ trailing slash'
817819
];
818820

819821
yield 'geo_routes_list' => [
820822
'endpoint' => 'https://routes.geo.region.amazonaws.com/v2',
821823
'requestUri' => '/routes',
822824
'pathParams' => [],
823-
'expected' => 'https://routes.geo.region.amazonaws.com/v2/routes',
825+
'expected' => '/v2/routes',
824826
'description' => 'Geo routes service list operation'
825827
];
826828

827829
yield 'geo_maps_tiles' => [
828830
'endpoint' => 'https://maps.geo.us-east-1.amazonaws.com/v2',
829831
'requestUri' => '/maps/{MapName}/tiles/{Z}/{X}/{Y}',
830832
'pathParams' => ['MapName' => 'test-map', 'Z' => '10', 'X' => '512', 'Y' => '256'],
831-
'expected' => 'https://maps.geo.us-east-1.amazonaws.com/v2/maps/test-map/tiles/10/512/256',
833+
'expected' => '/v2/maps/test-map/tiles/10/512/256',
832834
'description' => 'Geo maps with multiple path params'
833835
];
834836

835837
yield 'geo_with_query_params' => [
836838
'endpoint' => 'https://places.geo.region.amazonaws.com/v2',
837839
'requestUri' => '/search',
838840
'pathParams' => ['ApiKey' => 'test-key', 'Language' => 'en'],
839-
'expected' => 'https://places.geo.region.amazonaws.com/v2/search?key=test-key&lang=en',
841+
'expected' => '/v2/search?key=test-key&lang=en',
840842
'description' => 'Geo service with query parameters via location'
841843
];
842844
}
@@ -865,7 +867,7 @@ public function testGeoServiceEndpointResolutionE2E(
865867
Middleware::tap(function ($cmd, $req) use ($expected, $description) {
866868
$this->assertEquals(
867869
$expected,
868-
(string) $req->getUri(),
870+
$req->getRequestTarget(),
869871
"E2E Geo Service - {$description}"
870872
);
871873
})
@@ -881,7 +883,7 @@ public static function geoServiceE2EProvider(): \Generator
881883
'region' => 'us-east-1',
882884
'operation' => 'getPlace',
883885
'params' => ['PlaceId' => 'test-place-123'],
884-
'expected' => 'https://places.geo.us-east-1.amazonaws.com/v2/place/test-place-123',
886+
'expected' => '/v2/place/test-place-123',
885887
'description' => 'Geo Places with /v2 path'
886888
];
887889

@@ -890,7 +892,7 @@ public static function geoServiceE2EProvider(): \Generator
890892
'region' => 'eu-west-1',
891893
'operation' => 'getPlace',
892894
'params' => ['PlaceId' => 'place-abc-456'],
893-
'expected' => 'https://places.geo.eu-west-1.amazonaws.com/v2/place/place-abc-456',
895+
'expected' => '/v2/place/place-abc-456',
894896
'description' => 'Geo Places in EU region'
895897
];
896898

@@ -899,7 +901,7 @@ public static function geoServiceE2EProvider(): \Generator
899901
'region' => 'us-east-1',
900902
'operation' => 'getPlace',
901903
'params' => ['PlaceId' => 'place@test.com'],
902-
'expected' => 'https://places.geo.us-east-1.amazonaws.com/v2/place/place%40test.com',
904+
'expected' => '/v2/place/place%40test.com',
903905
'description' => 'Geo Places with URL encoding'
904906
];
905907

@@ -911,7 +913,7 @@ public static function geoServiceE2EProvider(): \Generator
911913
'Origin' => [-122.4194, 37.7749],
912914
'Destination' => [-118.2437, 34.0522],
913915
],
914-
'expected' => 'https://routes.geo.us-west-2.amazonaws.com/v2/routes',
916+
'expected' => '/v2/routes',
915917
'description' => 'Geo Routes calculate endpoint'
916918
];
917919

@@ -925,7 +927,7 @@ public static function geoServiceE2EProvider(): \Generator
925927
'X' => '512',
926928
'Y' => '256'
927929
],
928-
'expected' => 'https://maps.geo.ap-southeast-1.amazonaws.com/v2/tiles/test-tileset/10/512/256',
930+
'expected' => '/v2/tiles/test-tileset/10/512/256',
929931
'description' => 'Geo Maps with multiple path parameters'
930932
];
931933
}

0 commit comments

Comments
 (0)