loginAs($this->user); $this->assertResponseIsSuccessful(); $this->get('/api/gps-coordinate-reverse/48.8566/2.3522'); $this->assertResponseStatusCodeSame(200); $this->assertJsonContains([ '@context' => '/api/contexts/GpsCoordinate', '@id' => '/api/gps-coordinate-reverse/48.8564263/2.3525275780116', '@type' => 'GpsCoordinate', 'latitude' => 48.856426299999995, 'longitude' => 2.3525275780116073, 'streetAddress' => "Place de l'Hôtel de Ville", 'streetAddressSecond' => null, 'streetAddressThird' => null, 'cp' => "75004", 'city' => null, 'country' => null ]); } public function testGetGpsCoordinateSearching() { $this->loginAs($this->user); $this->assertResponseIsSuccessful(); $this->get('/api/gps-coordinate-searching'); $this->assertResponseStatusCodeSame(200); $this->assertJsonContains([ '@context' => '/api/contexts/GpsCoordinate', '@id' => '/api/gps-coordinate-searching', '@type' => 'hydra:Collection', 'hydra:totalItems' => 1, 'hydra:member' => [ [ '@id' => '/api/gps-coordinate-reverse/0/0', '@type' => 'GpsCoordinate', 'latitude' => 0, 'longitude' => 0, 'streetAddress' => null, 'streetAddressSecond' => null, 'streetAddressThird' => null, 'cp' => null, 'city' => null, 'country' => null ] ] ]); } public function testGetGpsCoordinateReverseWithInvalidCoordinates(): void { $this->loginAs($this->user); $this->get('/api/gps-coordinate-reverse/12345.6789/98765.4321'); $this->assertResponseStatusCodeSame(404); $this->assertJsonContains([ '@context' => '/api/contexts/Error', '@type' => 'hydra:Error', 'hydra:title' => 'An error occurred', 'hydra:description' => 'Failed to retrieve GPS coordinates: No address found for the given GPS coordinates.', ]); } }