Passed
Push — release/v2 ( 119cbe...817cd6 )
by Benoit
02:50
created

MinLengthTest::testInvalidConfiguration()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace JBen87\ParsleyBundle\Tests\Constraint\Constraints;
4
5
use JBen87\ParsleyBundle\Constraint\Constraints as ParsleyAssert;
6
use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException;
7
use Symfony\Component\OptionsResolver\Exception\MissingOptionsException;
8
9
class MinLengthTest extends ConfiguredConstraintTestCase
10
{
11
    public function testEmptyConfiguration(): void
12
    {
13
        $this->expectException(MissingOptionsException::class);
14
15
        new ParsleyAssert\MinLength();
16
    }
17
18
    public function testInvalidConfiguration(): void
19
    {
20
        $this->expectException(InvalidOptionsException::class);
21
22
        new ParsleyAssert\MinLength([
23
            'min' => '5',
24
        ]);
25
    }
26
27
    public function testNormalization(): void
28
    {
29
        $constraint = new ParsleyAssert\MinLength([
30
            'min' => 5,
31
        ]);
32
33
        $this->assertSame([
34
            'data-parsley-minlength' => '5',
35
            'data-parsley-minlength-message' => 'Invalid.',
36
        ], $constraint->normalize($this->normalizer));
37
    }
38
}
39