Skip to content

Commit

Permalink
fix attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
Gummibeer committed Mar 2, 2020
1 parent 83469e8 commit 9375a54
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
9 changes: 9 additions & 0 deletions tests/UrlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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('<img src="https://images.weserv.nl?url=https%3A%2F%2Fexample.com%2Fimage.jpg" />', $url->toImg());
}
}

0 comments on commit 9375a54

Please sign in to comment.