Extends
lithium\test\Unit
Tests that `action\Request` correctly inherits the functionality of the `to()` method
inherited from `lithium\net\http\Request`.
Source
public function testConvertToUrl() {
$request = new Request(array(
'env' => array('HTTP_HOST' => 'foo.com', 'HTTPS' => 'on'),
'base' => '/the/base/path',
'url' => '/the/url',
'query' => array('some' => 'query', 'parameter' => 'values')
));
$expected = 'https://foo.com/the/base/path/the/url?some=query¶meter=values';
$this->assertEqual($expected, $request->to('url'));
$request = new Request(array(
'env' => array('HTTP_HOST' => 'foo.com'),
'base' => '/',
'url' => '/',
'query' => array()
));
$expected = 'http://foo.com/';
$this->assertEqual($expected, $request->to('url'));
$request = new Request(array(
'url' => 'foo/bar',
'base' => null,
'env' => array('HTTP_HOST' => 'example.com', 'PHP_SELF' => '/index.php')
));
$expected = 'http://example.com/foo/bar';
$this->assertEqual($expected, $request->to('url'));
}