Skip to content

Commit

Permalink
[Validator] Add test for D regex modifier in TimeValidator
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandre-daubois committed Aug 13, 2024
1 parent b97382b commit 44fa633
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Tests/Constraints/TimeValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,19 @@ public function testValidTimesWithoutSeconds(string $time)
$this->assertNoViolation();
}

/**
* @dataProvider getValidTimesWithoutSeconds
*/
public function testValidTimesWithoutSecondsWithNewLine(string $time)
{
$this->validator->validate($time."\n", new Time(withSeconds: false));

$this->buildViolation('This value is not a valid time.')
->setParameter('{{ value }}', '"'.$time."\n".'"')
->setCode(Time::INVALID_FORMAT_ERROR)
->assertRaised();
}

public static function getValidTimesWithoutSeconds()
{
return [
Expand Down

0 comments on commit 44fa633

Please sign in to comment.