Skip to content

Commit 2b2050a

Browse files
[Validator] Add test for D regex modifier in TimeValidator
1 parent 2320f3d commit 2b2050a

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)