From bb06a88a5efff847efe239c55d547a872aac39da Mon Sep 17 00:00:00 2001 From: Till Berger Date: Thu, 3 Mar 2022 10:52:04 +0100 Subject: [PATCH] Fix image layout tests with newer PHPUnit versions `assertSame` uses a stricter epsilon since version 9.5.14 (absolute `PHP_FLOAT_EPSILON`), see https://github.com/sebastianbergmann/phpunit/pull/4874. Just rely on the recently introduced `Helpers::lengthEqual` for length comparison. --- tests/LayoutTest/ImageTest.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/LayoutTest/ImageTest.php b/tests/LayoutTest/ImageTest.php index c80b06509..54dea4c6f 100644 --- a/tests/LayoutTest/ImageTest.php +++ b/tests/LayoutTest/ImageTest.php @@ -3,6 +3,7 @@ use Dompdf\Dompdf; use Dompdf\FrameDecorator\AbstractFrameDecorator; +use Dompdf\Helpers; use Dompdf\Options; use Dompdf\Tests\TestCase; @@ -216,7 +217,13 @@ public function testImageDimensions( ); $dompdf->render(); - $this->assertSame($expectedWidth, $width); - $this->assertSame($expectedHeight, $height); + $this->assertTrue( + Helpers::lengthEqual($expectedWidth, $width), + "Failed asserting that width $width is equal to $expectedWidth." + ); + $this->assertTrue( + Helpers::lengthEqual($expectedHeight, $height), + "Failed asserting that height $height is equal to $expectedHeight." + ); } }