expectException(UnexpectedTypeException::class); $this->validator->validate('foo', new NotBlank()); } public function testEndBeforeStartIsInvalid() { $begin = new \DateTime(); $end = new \DateTime('-1 hour'); $project = new Project(); $project->setStart($begin); $project->setEnd($end); $this->validator->validate($project, new ProjectConstraint()); $this->buildViolation('End date must not be earlier then start date.') ->atPath('property.path.end') ->setCode(ProjectConstraint::END_BEFORE_BEGIN_ERROR) ->assertRaised(); } }