Skip to content

Commit

Permalink
Fix image layout tests with newer PHPUnit versions
Browse files Browse the repository at this point in the history
`assertSame` uses a stricter epsilon since version 9.5.14 (absolute
`PHP_FLOAT_EPSILON`), see sebastianbergmann/phpunit#4874.
Just rely on the recently introduced `Helpers::lengthEqual` for length
comparison.
  • Loading branch information
Mellthas committed Mar 3, 2022
1 parent 513a6cd commit 3117d9d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tests/LayoutTest/ImageTest.php
Expand Up @@ -3,6 +3,7 @@

use Dompdf\Dompdf;
use Dompdf\FrameDecorator\AbstractFrameDecorator;
use Dompdf\Helpers;
use Dompdf\Options;
use Dompdf\Tests\TestCase;

Expand Down Expand Up @@ -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 is equal to $expectedWidth."
);
$this->assertTrue(
Helpers::lengthEqual($expectedHeight, $height),
"Failed asserting that $height is equal to $expectedHeight."
);
}
}

0 comments on commit 3117d9d

Please sign in to comment.