public function LinkExternalProtocolsConstraintValidatorTest::providerValidate in Zircon Profile 8
Same name and namespace in other branches
- 8.0 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 51 - Contains \Drupal\Tests\link\Unit\Plugin\Validation\Constraint\LinkExternalProtocolsConstraintValidatorTest.
Class
- LinkExternalProtocolsConstraintValidatorTest
- @coversDefaultClass \Drupal\link\Plugin\Validation\Constraint\LinkExternalProtocolsConstraintValidator @group Link
Namespace
Drupal\Tests\link\Unit\Plugin\Validation\ConstraintCode
public function providerValidate() {
$data = [];
// Test allowed protocols.
$data[] = [
'http://www.drupal.org',
TRUE,
];
$data[] = [
'https://www.drupal.org',
TRUE,
];
$data[] = [
'magnet:?xt=urn:sha1:YNCKHTQCWBTRNJIV4WNAE52SJUQCZO5C',
TRUE,
];
// Invalid protocols.
$data[] = [
'ftp://ftp.funet.fi/pub/standards/RFC/rfc959.txt',
FALSE,
];
foreach ($data as &$single_data) {
$url = Url::fromUri($single_data[0]);
$link = $this
->getMock('Drupal\\link\\LinkItemInterface');
$link
->expects($this
->any())
->method('getUrl')
->willReturn($url);
$single_data[0] = $link;
}
return $data;
}