From 9404b33627dc22f47f57fb71d8d96641bd2be4de Mon Sep 17 00:00:00 2001 From: Jannik Renfordt Date: Wed, 3 Apr 2024 20:15:33 +0200 Subject: [PATCH] Add base64 output test to InitialsAvatarTest This commit introduces a new test case to the `InitialsAvatarTest` suite. This new test verifies that the `generate()` function, with 'base64' as an argument, provides the expected Base64 output. --- tests/InitialsAvatarTest.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/InitialsAvatarTest.php b/tests/InitialsAvatarTest.php index 0df907a..66c8438 100644 --- a/tests/InitialsAvatarTest.php +++ b/tests/InitialsAvatarTest.php @@ -56,4 +56,16 @@ public function testSetSize(): void $initialsAvatar->generate() ); } + + public function testGenerateWithBase64(): void + { + $initialsAvatar = new InitialsAvatar('Test Name'); + $svg = $initialsAvatar->generate(); + $base64 = $initialsAvatar->generate([], 'base64'); + + $this->assertEquals( + 'data:image/svg+xml;base64,'.base64_encode($svg), + $base64 + ); + } } \ No newline at end of file