예제 #1
0
파일: UrlTest.php 프로젝트: weew/url
 public function test_sample()
 {
     $url = new Url('{subdomain}.service.com/users/{id}/profile');
     $url->replace('subdomain', 'api');
     $url->replace('id', 1);
     $this->assertEquals('api.service.com/users/1/profile', $url->toString());
     $url = new Url('{subdomain}.service.com/users/{id}/profile');
     $url->replaceAll(['subdomain' => 'api', 'id' => 1]);
     $this->assertEquals('api.service.com/users/1/profile', $url->toString());
 }
예제 #2
0
 public function test_header_location()
 {
     $url = new Url('http://foo.bar');
     $redirect = new RedirectResponse($url);
     $this->assertEquals($url->toString(), $redirect->getHeaders()->find('Location'));
 }