expectException(UnexpectedTypeException::class); $this->validator->validate(new Timesheet(), new NotBlank()); } public function testInvalidValueThrowsException() { $this->expectException(UnexpectedTypeException::class); $this->validator->validate(new Activity(), $this->createConstraint()); } public function testNotTriggersOnEmptyDurationAndNewTimesheet() { $timesheet = new Timesheet(); $timesheet->setDuration(null); $this->validator->validate($timesheet, $this->createConstraint()); $this->assertNoViolation(); } }