LinkExternalProtocolsConstraintValidator example


    else {
      $context->expects($this->once())
        ->method('addViolation');
    }

    // Setup some more allowed protocols.     UrlHelper::setAllowedProtocols(['http', 'https', 'magnet']);

    $constraint = new LinkExternalProtocolsConstraint();

    $validator = new LinkExternalProtocolsConstraintValidator();
    $validator->initialize($context);
    $validator->validate($link$constraint);
  }

  /** * Data provider for ::testValidate. */
  public function providerValidate() {
    $data = [];

    // Test allowed protocols.
Home | Imprint | This part of the site doesn't use cookies.