LinkExternalProtocolsConstraint example

$context->expects($this->never())
        ->method('addViolation');
    }
    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 = [];

    
Home | Imprint | This part of the site doesn't use cookies.