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