You are here

public function UriTest::testCanTransformAndRetrievePartsIndividually in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/guzzlehttp/psr7/tests/UriTest.php \GuzzleHttp\Tests\Psr7\UriTest::testCanTransformAndRetrievePartsIndividually()

File

vendor/guzzlehttp/psr7/tests/UriTest.php, line 41

Class

UriTest
@covers GuzzleHttp\Psr7\Uri

Namespace

GuzzleHttp\Tests\Psr7

Code

public function testCanTransformAndRetrievePartsIndividually() {
  $uri = (new Uri(''))
    ->withFragment('#test')
    ->withHost('example.com')
    ->withPath('path/123')
    ->withPort(8080)
    ->withQuery('?q=abc')
    ->withScheme('http')
    ->withUserInfo('user', 'pass');

  // Test getters.
  $this
    ->assertEquals('user:pass@example.com:8080', $uri
    ->getAuthority());
  $this
    ->assertEquals('test', $uri
    ->getFragment());
  $this
    ->assertEquals('example.com', $uri
    ->getHost());
  $this
    ->assertEquals('path/123', $uri
    ->getPath());
  $this
    ->assertEquals(8080, $uri
    ->getPort());
  $this
    ->assertEquals('q=abc', $uri
    ->getQuery());
  $this
    ->assertEquals('http', $uri
    ->getScheme());
  $this
    ->assertEquals('user:pass', $uri
    ->getUserInfo());
}