public function UrlValidatorTest::testValidRelative

Tests valid relative URLs.

@dataProvider providerTestValidRelativeData

Parameters

string $url: The url to test.

string $prefix: The prefix to test.

File

drupal/core/tests/Drupal/Tests/Core/Common/UrlValidatorTest.php, line 124
Contains \Drupal\Tests\Core\Common\UrlValidatorTest.

Class

UrlValidatorTest
Tests URL validation by valid_url().

Namespace

Drupal\Tests\Core\Common

Code

public function testValidRelative($url, $prefix) {
  $test_url = $prefix . $url;
  $valid_url = Urlvalidator::isValid($test_url);
  $this
    ->assertTrue($valid_url, String::format('@url is a valid URL.', array(
    '@url' => $test_url,
  )));
}