Skip to content

Commit 0dfaf96

Browse files
minor symfony#57991 [Validator] Add test for D regex modifier in TimeValidator (alexandre-daubois)
This PR was merged into the 6.4 branch. Discussion ---------- [Validator] Add test for `D` regex modifier in `TimeValidator` | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | - | License | MIT Commits ------- 2b2050a [Validator] Add test for `D` regex modifier in `TimeValidator`
2 parents 2320f3d + 2b2050a commit 0dfaf96

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,19 @@ public function testValidTimesWithoutSeconds(string $time)
9494
$this->assertNoViolation();
9595
}
9696

97+
/**
98+
* @dataProvider getValidTimesWithoutSeconds
99+
*/
100+
public function testValidTimesWithoutSecondsWithNewLine(string $time)
101+
{
102+
$this->validator->validate($time."\n", new Time(withSeconds: false));
103+
104+
$this->buildViolation('This value is not a valid time.')
105+
->setParameter('{{ value }}', '"'.$time."\n".'"')
106+
->setCode(Time::INVALID_FORMAT_ERROR)
107+
->assertRaised();
108+
}
109+
97110
public static function getValidTimesWithoutSeconds()
98111
{
99112
return [

0 commit comments

Comments
 (0)