function LinkExternalProtocolsConstraintValidatorTest::providerValidate

Same name in other branches
  1. 9 core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkExternalProtocolsConstraintValidatorTest.php \Drupal\Tests\link\Unit\Plugin\Validation\Constraint\LinkExternalProtocolsConstraintValidatorTest::providerValidate()
  2. 8.9.x core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkExternalProtocolsConstraintValidatorTest.php \Drupal\Tests\link\Unit\Plugin\Validation\Constraint\LinkExternalProtocolsConstraintValidatorTest::providerValidate()
  3. 11.x core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkExternalProtocolsConstraintValidatorTest.php \Drupal\Tests\link\Unit\Plugin\Validation\Constraint\LinkExternalProtocolsConstraintValidatorTest::providerValidate()

Data provider for ::testValidate.

File

core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkExternalProtocolsConstraintValidatorTest.php, line 54

Class

LinkExternalProtocolsConstraintValidatorTest
@coversDefaultClass \Drupal\link\Plugin\Validation\Constraint\LinkExternalProtocolsConstraintValidator @group Link

Namespace

Drupal\Tests\link\Unit\Plugin\Validation\Constraint

Code

public static function providerValidate() {
    $data = [];
    // Test allowed protocols.
    $data[] = [
        'http://www.example.com',
        TRUE,
    ];
    $data[] = [
        'https://www.example.com',
        TRUE,
    ];
    // cSpell:disable-next-line
    $data[] = [
        'magnet:?xt=urn:sha1:YNCKHTQCWBTRNJIV4WNAE52SJUQCZO5C',
        TRUE,
    ];
    // Invalid protocols.
    $data[] = [
        'ftp://ftp.funet.fi/pub/standards/RFC/rfc959.txt',
        FALSE,
    ];
    return $data;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.