generateUrl($address); // THEN expect($url)->toBe('https://www.openstreetmap.org/?mlat=48.8566&mlon=2.3522#map=16/48.8566/2.3522'); }); it('generates a Google Maps URL when coordinates are missing', function () { // GIVEN $service = new MapUrlService(); $address = new DeliveryAddress( name: 'My Shop', address: '123 Test St', postcode: '12345', city: 'Test City', phone: null, latitude: null, longitude: null, ); // WHEN $url = $service->generateUrl($address); // THEN $query = urlencode('My Shop 123 Test St 12345 Test City'); expect($url)->toBe("https://maps.google.com/?q={$query}"); }); it('generates an OpenStreetMap URL for a ShopDto', function () { // GIVEN $service = new MapUrlService(); $shopDto = new ShopDto( id: 'test-id', name: 'DTO Shop', address: '456 DTO St', postcode: '69001', city: 'Lyon', phone: null, latitude: '45.75', longitude: '4.85', default: false, ); // WHEN $url = $service->generateUrl($shopDto); // THEN expect($url)->toBe('https://www.openstreetmap.org/?mlat=45.75&mlon=4.85#map=16/45.75/4.85'); }); });