function LinkExternalProtocolsConstraintValidatorTest::providerValidate

Same name in other branches
  1. 8.9.x core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkExternalProtocolsConstraintValidatorTest.php \Drupal\Tests\link\Unit\Plugin\Validation\Constraint\LinkExternalProtocolsConstraintValidatorTest::providerValidate()
  2. 10 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 52

Class

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

Namespace

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

Code

public function providerValidate() {
    $data = [];
    // Test allowed protocols.
    $data[] = [
        'http://www.drupal.org',
        TRUE,
    ];
    $data[] = [
        'https://www.drupal.org',
        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.