Skip to content

Commit b06c6ba

Browse files
Add 16/9 test
1 parent d054e64 commit b06c6ba

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed
Loading

src/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ protected function setUp(): void
4848
$this->imageLandscape = __DIR__.'/Fixtures/test_landscape.gif';
4949
$this->imagePortrait = __DIR__.'/Fixtures/test_portrait.gif';
5050
$this->image4By3 = __DIR__.'/Fixtures/test_4by3.gif';
51+
$this->image16By9 = __DIR__.'/Fixtures/test_16by9.gif';
5152
$this->imageCorrupted = __DIR__.'/Fixtures/test_corrupted.gif';
5253
}
5354

@@ -304,18 +305,28 @@ public function testMaxRatioUsesTwoDecimalsOnly()
304305
$this->assertNoViolation();
305306
}
306307

307-
public function testMaxRatioUsesInputMoreDecimals()
308+
public function testMinRatioUsesInputMoreDecimals()
308309
{
309310
$constraint = new Image([
310311
'minRatio' => 4 / 3,
311-
'maxRatio' => 4 / 3,
312312
]);
313313

314314
$this->validator->validate($this->image4By3, $constraint);
315315

316316
$this->assertNoViolation();
317317
}
318318

319+
public function testMaxRatioUsesInputMoreDecimals()
320+
{
321+
$constraint = new Image([
322+
'minRatio' => 16 / 9,
323+
]);
324+
325+
$this->validator->validate($this->image16By9, $constraint);
326+
327+
$this->assertNoViolation();
328+
}
329+
319330
public function testInvalidMinRatio()
320331
{
321332
$this->expectException(ConstraintDefinitionException::class);

0 commit comments

Comments
 (0)