コード例 #1
0
ファイル: UriExtendTest.php プロジェクト: wandu/framework
 public function testWithQueryParams()
 {
     $url = new Uri('/hello?foo=30&bar=&baz');
     static::assertEquals('/hello?foo=30&bar=&baz', $url->__toString());
     static::assertEquals('/hello?foo=40&bar=&baz=', $url->withQueryParam('foo', 40)->__toString());
     static::assertEquals('/hello?foo=kkk+hhh&bar=&baz=', $url->withQueryParam('foo', 'kkk hhh')->__toString());
     static::assertEquals('/hello?bar=&baz=', $url->withQueryParam('foo', null)->__toString());
     static::assertEquals('/hello?bar=&baz=', $url->withoutQueryParam('foo')->__toString());
     static::assertEquals('/hello?foo=30&baz=', $url->withoutQueryParam('bar')->__toString());
     $url = new Uri('/hello?foo=30&bar=&baz');
     static::assertEquals('/hello?foo=30&bar=&baz', $url->__toString());
     static::assertEquals('/hello?foo=40&bar=&baz=', $url->withQueryParam('foo', 40)->__toString());
     static::assertEquals('/hello?bar=&baz=', $url->withQueryParam('foo', null)->__toString());
     static::assertEquals('/hello?foo=30&bar=&baz=&qux=40&quux=50', $url->withQueryParam('qux', 40)->withQueryParam('quux', 50)->__toString());
     static::assertEquals('/hello?bar=&baz=', $url->withoutQueryParam('foo')->__toString());
     static::assertEquals('/hello?foo=30&baz=', $url->withoutQueryParam('bar')->__toString());
 }
コード例 #2
0
ファイル: UriTest.php プロジェクト: Golpha/Http
 public function testUnicodeUrl()
 {
     $uri1 = new Uri('http://my.test.com/%EC%BD%94%EB%93%9C%EC%9D%B4%EA%B7%B8%EB%82%98%EC%9D%B4%ED%84%B0');
     $uri2 = new Uri('http://my.test.com/코드이그나이터');
     $this->assertEquals($uri1->getPath(), $uri2->getPath());
 }