From a1fb58e5b7a22e39f15e689d239caadcd35eb6ef Mon Sep 17 00:00:00 2001 From: Pavel Linhart Date: Tue, 30 Nov 2021 07:27:24 +0100 Subject: [PATCH] added gd tests --- tests/ResizerTest.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/tests/ResizerTest.php b/tests/ResizerTest.php index dd47f63..212eb3c 100755 --- a/tests/ResizerTest.php +++ b/tests/ResizerTest.php @@ -23,6 +23,7 @@ class ResizerTest extends TestCase private Resizer $resizer; private string $image; private ResizerConfig $config; + private ?string $thumbnail = null; public function __construct() @@ -75,9 +76,24 @@ public function testImageFound(): void public function testProcess(): void { + $thumbnail = FileSystem::normalizePath($this->resizer->process($this->image, 'c200xc200')); + + Assert::same( + FileSystem::normalizePath(__DIR__ . '/../temp/resizer/test.png/c200xc200.png'), + $thumbnail, + ); + } + + + public function testGeneratedImage(): void + { + $thumbnail = FileSystem::normalizePath($this->resizer->process($this->image, 'c200xc200')); + + $size = getimagesize($thumbnail); + Assert::same( - FileSystem::normalizePath(__DIR__ . '/../temp/resizer/test.png/200x.png'), - FileSystem::normalizePath($this->resizer->process($this->image, '200x')), + [200, 200], + [$size[0], $size[1]], ); }