diff --git a/tests/kohana/RequestTest.php b/tests/kohana/RequestTest.php index 415e0f091..8c617ad43 100644 --- a/tests/kohana/RequestTest.php +++ b/tests/kohana/RequestTest.php @@ -126,6 +126,50 @@ function testAcceptLang($params, $expected, $enviroment) Request::accept_lang($params) ); } + + /** + * Provides test data for Request::url() + * @return array + */ + public function provider_url() + { + return array( + array( + 'foo/bar', + array(), + 'http', + TRUE, + 'http://localhost/foo/bar' + ), + array( + 'foo', + array('action' => 'bar'), + 'http', + TRUE, + 'http://localhost/foo/bar' + ), + ); + } + + /** + * Tests Request::url() + * + * @test + * @dataProvider provider_url + * @param string $route the route to use + * @param array $params params to pass to route::uri + * @param string $protocol the protocol to use + * @param array $expected The string we expect + */ + public function test_url($uri, $params, $protocol, $is_cli, $expected) + { + $this->setEnvironment(array( + '_SERVER' => array('HTTP_HOST' => 'localhost', 'argc' => $_SERVER['argc']), + 'Kohana::$is_cli' => $is_cli, + )); + + $this->assertEquals(Request::instance($uri)->url($params, $protocol), $expected); + } } class Controller_Foo extends Controller {