diff --git a/src/Url.php b/src/Url.php index fc08abd..0fefed2 100644 --- a/src/Url.php +++ b/src/Url.php @@ -547,7 +547,7 @@ protected function getAttributes(array $attr): string return implode( ' ', array_map( - fn ($k, $v) => sprintf('%s="%s"', $k, htmlspecialchars($v)), + fn ($k, $v) => sprintf('%s="%s"', $k, $v), array_keys($attr), $attr ) diff --git a/tests/UrlTest.php b/tests/UrlTest.php index f91d0eb..51229b8 100644 --- a/tests/UrlTest.php +++ b/tests/UrlTest.php @@ -35,4 +35,13 @@ public function it_can_build_with_custom_dimensions(): void static::assertInstanceOf(Url::class, $url); static::assertSame('https://images.weserv.nl?w=1920&h=1080&fit=contain&we=1&url=https%3A%2F%2Fexample.com%2Fimage.jpg', (string) $url); } + + /** @test */ + public function it_can_transform_to_img_tag(): void + { + $url = new Url('https://example.com/image.jpg'); + + static::assertInstanceOf(Url::class, $url); + static::assertSame('', $url->toImg()); + } }