public function UrlValidatorTest::testInvalidRelative

Tests invalid relative URLs.

@dataProvider providerTestInvalidRelativeData

Parameters

string $url: The url to test.

string $prefix: The prefix to test.

File

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

Class

UrlValidatorTest
Tests URL validation by valid_url().

Namespace

Drupal\Tests\Core\Common

Code

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