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