Total Complexity | 3 |
Total Lines | 28 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
9 | class PatternTest extends ConfiguredConstraintTestCase |
||
10 | { |
||
11 | public function testEmptyConfiguration(): void |
||
12 | { |
||
13 | $this->expectException(MissingOptionsException::class); |
||
14 | |||
15 | new ParsleyAssert\Pattern(); |
||
16 | } |
||
17 | |||
18 | public function testInvalidConfiguration(): void |
||
19 | { |
||
20 | $this->expectException(InvalidOptionsException::class); |
||
21 | |||
22 | new ParsleyAssert\Pattern([ |
||
23 | 'pattern' => false, |
||
24 | ]); |
||
25 | } |
||
26 | |||
27 | public function testNormalization(): void |
||
28 | { |
||
29 | $constraint = new ParsleyAssert\Pattern([ |
||
30 | 'pattern' => '\w', |
||
31 | ]); |
||
32 | |||
33 | $this->assertSame([ |
||
34 | 'data-parsley-pattern' => '\w', |
||
35 | 'data-parsley-pattern-message' => 'Invalid.', |
||
36 | ], $constraint->normalize($this->normalizer)); |
||
37 | } |
||
39 |