function UrlHelperTest::testInvalidRelative

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php \Drupal\Tests\Component\Utility\UrlHelperTest::testInvalidRelative()
  2. 8.9.x core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php \Drupal\Tests\Component\Utility\UrlHelperTest::testInvalidRelative()
  3. 10 core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php \Drupal\Tests\Component\Utility\UrlHelperTest::testInvalidRelative()

Tests invalid relative URLs.

@dataProvider providerTestInvalidRelativeData @covers ::isValid

Parameters

string $url: The URL to test.

string $prefix: The prefix to test.

File

core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php, line 213

Class

UrlHelperTest
@group Utility

Namespace

Drupal\Tests\Component\Utility

Code

public function testInvalidRelative(string $url, string $prefix) : void {
    $test_url = $prefix . $url;
    $valid_url = UrlHelper::isValid($test_url);
    $this->assertFalse($valid_url, $test_url . ' is NOT a valid URL.');
}

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