createMyValidator(); } protected function createMyValidator(bool $isGranted = true) { return new TimesheetValidator([]); } public function testConstraintIsInvalid() { $this->expectException(UnexpectedTypeException::class); $this->validator->validate(new Timesheet(), new NotBlank()); } public function testInvalidValueThrowsException() { $this->expectException(UnexpectedTypeException::class); $this->validator->validate(new NotBlank(), new TimesheetConstraint(['message' => 'myMessage'])); } }