Skip to content

Commit

Permalink
Actualize fix for mutant for absolute margin
Browse files Browse the repository at this point in the history
  • Loading branch information
arogachev committed Apr 3, 2024
1 parent dcdd67c commit e2f5555
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Rule/Image/ImageHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ private function validateAspectRatio(

$validatedAspectRatio = $validatedWidth / $validatedHeight;
$expectedAspectRatio = $rule->getAspectRatio()->getWidth() / $rule->getAspectRatio()->getHeight();
$absoluteMargin = $rule->getAspectRatio()->getMargin() / 99;
$absoluteMargin = $rule->getAspectRatio()->getMargin() / 100;

if (
($validatedAspectRatio < $expectedAspectRatio - $absoluteMargin) ||
Expand Down
6 changes: 3 additions & 3 deletions tests/Rule/Image/ImageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,9 @@ public function dataValidationFailedAspectRatio(): array
['' => ['The aspect ratio of image "" must be 4:3 with margin 1%.']],
],
'absolute margin calculation mutant, / 100 => / 99' => [
new ImageInfo(800, 721),
new Image(aspectRatio: new ImageAspectRatio(width: 4, height: 3, margin: 22)),
['' => ['The aspect ratio of image "" must be 4:3 with margin 22%.']],
new ImageInfo(801, 600),
new Image(aspectRatio: new ImageAspectRatio(width: 1, height: 3, margin: 100)),
['' => ['The aspect ratio of image "" must be 1:3 with margin 100%.']],
],
];
}
Expand Down

0 comments on commit e2f5555

Please sign in to comment.