| @@ 57-65 (lines=9) @@ | ||
| 54 | /** |
|
| 55 | * @test |
|
| 56 | */ |
|
| 57 | public function shouldDetectUnknownParameter() |
|
| 58 | { |
|
| 59 | $mapping = (new Mapping(RootType::ID))->setParameter('unknown', true); |
|
| 60 | $result = (new Validator())->validate($mapping); |
|
| 61 | Assert::assertEquals(1, $result->count()); |
|
| 62 | /** @var ConstraintViolation $violation */ |
|
| 63 | $violation = $result[0]; |
|
| 64 | Assert::assertInstanceOf(ExistingParameter::class, $violation->getConstraint()); |
|
| 65 | } |
|
| 66 | ||
| 67 | /** |
|
| 68 | * @test |
|
| @@ 70-78 (lines=9) @@ | ||
| 67 | /** |
|
| 68 | * @test |
|
| 69 | */ |
|
| 70 | public function shouldDetectInvalidParameterNaming() |
|
| 71 | { |
|
| 72 | $mapping = (new Mapping(BooleanType::ID))->setParameter('docValues', true); |
|
| 73 | $result = (new Validator())->validate($mapping); |
|
| 74 | Assert::assertEquals(1, $result->count()); |
|
| 75 | /** @var ConstraintViolation $violation */ |
|
| 76 | $violation = $result[0]; |
|
| 77 | Assert::assertInstanceOf(ValidParameterName::class, $violation->getConstraint()); |
|
| 78 | } |
|
| 79 | ||
| 80 | /** |
|
| 81 | * @test |
|
| @@ 83-91 (lines=9) @@ | ||
| 80 | /** |
|
| 81 | * @test |
|
| 82 | */ |
|
| 83 | public function shouldDetectInvalidParameterValue() |
|
| 84 | { |
|
| 85 | $mapping = (new Mapping(BooleanType::ID))->setParameter(DocValuesParameter::ID, 'twenty'); |
|
| 86 | $result = (new Validator())->validate($mapping); |
|
| 87 | Assert::assertEquals(1, $result->count()); |
|
| 88 | /** @var ConstraintViolation $violation */ |
|
| 89 | $violation = $result[0]; |
|
| 90 | Assert::assertInstanceOf(Type::class, $violation->getConstraint()); |
|
| 91 | } |
|
| 92 | ||
| 93 | /** |
|
| 94 | * @test |
|
| @@ 96-104 (lines=9) @@ | ||
| 93 | /** |
|
| 94 | * @test |
|
| 95 | */ |
|
| 96 | public function shouldDetectMisplacedParameter() |
|
| 97 | { |
|
| 98 | $mapping = (new Mapping(BooleanType::ID))->setParameter(DynamicParameter::ID, false); |
|
| 99 | $result = (new Validator())->validate($mapping); |
|
| 100 | Assert::assertEquals(1, $result->count()); |
|
| 101 | /** @var ConstraintViolation $violation */ |
|
| 102 | $violation = $result[0]; |
|
| 103 | Assert::assertInstanceOf(ApplicableParameter::class, $violation->getConstraint()); |
|
| 104 | } |
|
| 105 | ||
| 106 | /** |
|
| 107 | * @test |
|
| @@ 109-117 (lines=9) @@ | ||
| 106 | /** |
|
| 107 | * @test |
|
| 108 | */ |
|
| 109 | public function shouldDetectIllegalNull() |
|
| 110 | { |
|
| 111 | $mapping = (new Mapping(BooleanType::ID))->setParameter(DocValuesParameter::ID, null); |
|
| 112 | $result = (new Validator())->validate($mapping); |
|
| 113 | Assert::assertEquals(1, $result->count()); |
|
| 114 | /** @var ConstraintViolation $violation */ |
|
| 115 | $violation = $result[0]; |
|
| 116 | Assert::assertInstanceOf(NotNull::class, $violation->getConstraint()); |
|
| 117 | } |
|
| 118 | ||
| 119 | /** |
|
| 120 | * @test |
|