*/ final class GroupParentNotSelfValidatorTest extends ConstraintValidatorTestCase { protected function createValidator(): GroupParentNotSelfValidator { return new GroupParentNotSelfValidator(); } public function testIsValid(): void { $this->validator->validate(new Group(), new GroupParentNotSelf()); $this->assertNoViolation(); } public function testIsInvalid(): void { $group = new Group(); $group->setParent($group); $this->validator->validate($group, new GroupParentNotSelf()); $this->buildViolation('validator.group.groupparentnotself') ->atPath('property.path.parent') ->assertRaised(); } public function testInvalidValueType(): void { $this->expectException(UnexpectedValueException::class); $this->validator->validate(new User(), new GroupParentNotSelf()); } public function testInvalidConstraintType(): void { $this->expectException(UnexpectedTypeException::class); $this->validator->validate('foo', new Length(['max' => 5])); } }