You are here

public function UrlTest::testGetUriForProtocolRelativeUrl in Drupal 8

Tests the getUri() and isExternal() methods for protocol-relative URLs.

@covers ::getUri @covers ::isExternal

File

core/tests/Drupal/Tests/Core/UrlTest.php, line 342
Contains \Drupal\Tests\Core\UrlTest.

Class

UrlTest
@coversDefaultClass \Drupal\Core\Url @group UrlTest

Namespace

Drupal\Tests\Core

Code

public function testGetUriForProtocolRelativeUrl() {
  $url = Url::fromUri('//example.com/test');
  $this
    ->assertEquals('//example.com/test', $url
    ->getUri());
  $this
    ->assertTrue($url
    ->isExternal());
}