| @@ 15-33 (lines=19) @@ | ||
| 12 | use JVal\Context; |
|
| 13 | use JVal\Testing\ConstraintTestCase; |
|
| 14 | ||
| 15 | class FormatConstraintTest extends ConstraintTestCase |
|
| 16 | { |
|
| 17 | public function testNormalizeThrowsIfFormatIsNotString() |
|
| 18 | { |
|
| 19 | $this->expectConstraintException('InvalidTypeException', '/format'); |
|
| 20 | $schema = $this->loadSchema('invalid/format-not-string'); |
|
| 21 | $this->getConstraint()->normalize($schema, new Context(), $this->mockWalker()); |
|
| 22 | } |
|
| 23 | ||
| 24 | protected function getConstraint() |
|
| 25 | { |
|
| 26 | return new FormatConstraint(); |
|
| 27 | } |
|
| 28 | ||
| 29 | protected function getCaseFileNames() |
|
| 30 | { |
|
| 31 | return ['format']; |
|
| 32 | } |
|
| 33 | } |
|
| 34 | ||
| @@ 15-33 (lines=19) @@ | ||
| 12 | use JVal\Context; |
|
| 13 | use JVal\Testing\ConstraintTestCase; |
|
| 14 | ||
| 15 | class UniqueItemsConstraintTest extends ConstraintTestCase |
|
| 16 | { |
|
| 17 | public function testNormalizeThrowsIfUniqueItemsIsNotBoolean() |
|
| 18 | { |
|
| 19 | $this->expectConstraintException('InvalidTypeException', '/uniqueItems'); |
|
| 20 | $schema = $this->loadSchema('invalid/uniqueItems-not-boolean'); |
|
| 21 | $this->getConstraint()->normalize($schema, new Context(), $this->mockWalker()); |
|
| 22 | } |
|
| 23 | ||
| 24 | protected function getConstraint() |
|
| 25 | { |
|
| 26 | return new UniqueItemsConstraint(); |
|
| 27 | } |
|
| 28 | ||
| 29 | protected function getCaseFileNames() |
|
| 30 | { |
|
| 31 | return ['uniqueItems']; |
|
| 32 | } |
|
| 33 | } |
|
| 34 | ||