Code Duplication    Length = 26-26 lines in 6 locations

tests/Constraint/MaxItemsConstraintTest.php 1 location

@@ 15-40 (lines=26) @@
12
use JVal\Context;
13
use JVal\Testing\ConstraintTestCase;
14
15
class MaxItemsConstraintTest extends ConstraintTestCase
16
{
17
    public function testNormalizeThrowsIfMaxItemsIsNotAnInteger()
18
    {
19
        $this->expectConstraintException('InvalidTypeException', '/maxItems');
20
        $schema = $this->loadSchema('invalid/maxItems-not-integer');
21
        $this->getConstraint()->normalize($schema, new Context(), $this->mockWalker());
22
    }
23
24
    public function testNormalizeThrowsIfMaxItemsIsNotPositive()
25
    {
26
        $this->expectConstraintException('LessThanZeroException', '/maxItems');
27
        $schema = $this->loadSchema('invalid/maxItems-not-positive');
28
        $this->getConstraint()->normalize($schema, new Context(), $this->mockWalker());
29
    }
30
31
    protected function getConstraint()
32
    {
33
        return new MaxItemsConstraint();
34
    }
35
36
    protected function getCaseFileNames()
37
    {
38
        return ['maxItems'];
39
    }
40
}
41

tests/Constraint/MaxLengthConstraintTest.php 1 location

@@ 15-40 (lines=26) @@
12
use JVal\Context;
13
use JVal\Testing\ConstraintTestCase;
14
15
class MaxLengthConstraintTest extends ConstraintTestCase
16
{
17
    public function testNormalizeThrowsIfMaxLengthIsNotAnInteger()
18
    {
19
        $this->expectConstraintException('InvalidTypeException', '/maxLength');
20
        $schema = $this->loadSchema('invalid/maxLength-not-integer');
21
        $this->getConstraint()->normalize($schema, new Context(), $this->mockWalker());
22
    }
23
24
    public function testNormalizeThrowsIfMaxLengthIsNotPositive()
25
    {
26
        $this->expectConstraintException('LessThanZeroException', '/maxLength');
27
        $schema = $this->loadSchema('invalid/maxLength-not-positive');
28
        $this->getConstraint()->normalize($schema, new Context(), $this->mockWalker());
29
    }
30
31
    protected function getConstraint()
32
    {
33
        return new MaxLengthConstraint();
34
    }
35
36
    protected function getCaseFileNames()
37
    {
38
        return ['maxLength'];
39
    }
40
}
41

tests/Constraint/MaxPropertiesTest.php 1 location

@@ 15-40 (lines=26) @@
12
use JVal\Context;
13
use JVal\Testing\ConstraintTestCase;
14
15
class MaxPropertiesTest extends ConstraintTestCase
16
{
17
    public function testNormalizeThrowsIfMaxPropertiesIsNotAnInteger()
18
    {
19
        $this->expectConstraintException('InvalidTypeException', '/maxProperties');
20
        $schema = $this->loadSchema('invalid/maxProperties-not-integer');
21
        $this->getConstraint()->normalize($schema, new Context(), $this->mockWalker());
22
    }
23
24
    public function testNormalizeThrowsIfMaxPropertiesIsNotPositive()
25
    {
26
        $this->expectConstraintException('LessThanZeroException', '/maxProperties');
27
        $schema = $this->loadSchema('invalid/maxProperties-not-positive');
28
        $this->getConstraint()->normalize($schema, new Context(), $this->mockWalker());
29
    }
30
31
    protected function getConstraint()
32
    {
33
        return new MaxPropertiesConstraint();
34
    }
35
36
    protected function getCaseFileNames()
37
    {
38
        return ['maxProperties'];
39
    }
40
}
41

tests/Constraint/MinItemsConstraintTest.php 1 location

@@ 15-40 (lines=26) @@
12
use JVal\Context;
13
use JVal\Testing\ConstraintTestCase;
14
15
class MinItemsConstraintTest extends ConstraintTestCase
16
{
17
    public function testNormalizeThrowsIfMinItemsIsNotAnInteger()
18
    {
19
        $this->expectConstraintException('InvalidTypeException', '/minItems');
20
        $schema = $this->loadSchema('invalid/minItems-not-integer');
21
        $this->getConstraint()->normalize($schema, new Context(), $this->mockWalker());
22
    }
23
24
    public function testNormalizeThrowsIfMinItemsIsNotPositive()
25
    {
26
        $this->expectConstraintException('LessThanZeroException', '/minItems');
27
        $schema = $this->loadSchema('invalid/minItems-not-positive');
28
        $this->getConstraint()->normalize($schema, new Context(), $this->mockWalker());
29
    }
30
31
    protected function getConstraint()
32
    {
33
        return new MinItemsConstraint();
34
    }
35
36
    protected function getCaseFileNames()
37
    {
38
        return ['minItems'];
39
    }
40
}
41

tests/Constraint/MinLengthConstraintTest.php 1 location

@@ 15-40 (lines=26) @@
12
use JVal\Context;
13
use JVal\Testing\ConstraintTestCase;
14
15
class MinLengthConstraintTest extends ConstraintTestCase
16
{
17
    public function testNormalizeThrowsIfMinLengthIsNotAnInteger()
18
    {
19
        $this->expectConstraintException('InvalidTypeException', '/minLength');
20
        $schema = $this->loadSchema('invalid/minLength-not-integer');
21
        $this->getConstraint()->normalize($schema, new Context(), $this->mockWalker());
22
    }
23
24
    public function testNormalizeThrowsIfMinLengthIsNotPositive()
25
    {
26
        $this->expectConstraintException('LessThanZeroException', '/minLength');
27
        $schema = $this->loadSchema('invalid/minLength-not-positive');
28
        $this->getConstraint()->normalize($schema, new Context(), $this->mockWalker());
29
    }
30
31
    protected function getConstraint()
32
    {
33
        return new MinLengthConstraint();
34
    }
35
36
    protected function getCaseFileNames()
37
    {
38
        return ['minLength'];
39
    }
40
}
41

tests/Constraint/MinPropertiesConstraintTest.php 1 location

@@ 15-40 (lines=26) @@
12
use JVal\Context;
13
use JVal\Testing\ConstraintTestCase;
14
15
class MinPropertiesConstraintTest extends ConstraintTestCase
16
{
17
    public function testNormalizeThrowsIfMinPropertiesIsNotAnInteger()
18
    {
19
        $this->expectConstraintException('InvalidTypeException', '/minProperties');
20
        $schema = $this->loadSchema('invalid/minProperties-not-integer');
21
        $this->getConstraint()->normalize($schema, new Context(), $this->mockWalker());
22
    }
23
24
    public function testNormalizeThrowsIfMinPropertiesIsNotPositive()
25
    {
26
        $this->expectConstraintException('LessThanZeroException', '/minProperties');
27
        $schema = $this->loadSchema('invalid/minProperties-not-positive');
28
        $this->getConstraint()->normalize($schema, new Context(), $this->mockWalker());
29
    }
30
31
    protected function getConstraint()
32
    {
33
        return new MinPropertiesConstraint();
34
    }
35
36
    protected function getCaseFileNames()
37
    {
38
        return ['minProperties'];
39
    }
40
}
41