예제 #1
0
 /**
  * Tests whether parser and getter are working correctly.
  *
  * @dataProvider dataProviderTestParserAndGetter
  * @return void
  */
 public function testParserAndGetter($uriString, $expectedResult)
 {
     $uri = new Uri($uriString);
     $this->assertSame($expectedResult['scheme'], $uri->getScheme(), 'getScheme()');
     $this->assertSame($expectedResult['authority'], $uri->getAuthority(), 'getAuthority()');
     $this->assertSame($expectedResult['rawAuthority'], $uri->getRawAuthority(), 'getRawAuthority()');
     $this->assertSame($expectedResult['userInfo'], $uri->getUserInfo(), 'getUserInfo()');
     $this->assertSame($expectedResult['rawUserInfo'], $uri->getRawUserInfo(), 'getRawUserInfo()');
     $this->assertSame($expectedResult['host'], $uri->getHost(), 'getHost()');
     $this->assertSame($expectedResult['rawHost'], $uri->getRawHost(), 'getRawHost()');
     $this->assertSame($expectedResult['port'], $uri->getPort(), 'getPort()');
     $this->assertSame($expectedResult['path'], $uri->getPath(), 'getPath()');
     $this->assertSame($expectedResult['rawPath'], $uri->getRawPath(), 'getRawPath()');
     $this->assertSame($expectedResult['query'], $uri->getQuery(), 'getQuery()');
     $this->assertSame($expectedResult['rawQuery'], $uri->getRawQuery(), 'getRawQuery()');
     $this->assertSame($expectedResult['queryParameters'], $uri->getQueryParameters(), 'getQueryParameters()');
     $this->assertSame($expectedResult['fragment'], $uri->getFragment(), 'getFragment()');
     $this->assertSame($expectedResult['rawFragment'], $uri->getRawFragment(), 'getRawFragment()');
     $this->assertSame($expectedResult['isAbsolute'], $uri->isAbsolute(), 'isAbsolute()');
     $this->assertSame($expectedResult['externalForm'], $uri->toString(), 'toString()');
     $this->assertSame($expectedResult['normalized'], $uri->normalize()->toString(), 'normalize()');
 }