/**
  * {@inheritdoc}
  */
 public function validate($value, Constraint $constraint)
 {
     if (null === $value) {
         return;
     }
     if (!$constraint->type) {
         throw new ConstraintDefinitionException('"type" must be specified on constraint Expression');
     }
     if (!$this->registry->has($constraint->type)) {
         return;
     }
     $this->context->getValidator()->inContext($this->context)->validate($value, $this->registry->get($constraint->type));
 }
 public function testHas()
 {
     $this->assertFalse($this->subject->has('foobar'));
     $this->subject->register('foobar', $this->createMock(Constraint::class));
     $this->assertTrue($this->subject->has('foobar'));
 }