Extends
lithium\test\Unit
Tests matching routes and returning an absolute (protocol + hostname) URL.
Source
public function testRouteMatchAbsoluteUrl() {
Router::connect('/login', array('controller' => 'sessions', 'action' => 'add'));
$result = Router::match('Sessions::add', $this->request);
$base = $this->request->env('base');
$this->assertEqual($base . '/login', $result);
$result = Router::match('Sessions::add', $this->request, array('absolute' => true));
$base = $this->request->env('HTTPS') ? 'https://' : 'http://';
$base .= $this->request->env('HTTP_HOST');
$base .= $this->request->env('base');
$this->assertEqual($base . '/login', $result);
$result = Router::match('Sessions::add',
$this->request, array('host' => 'test.local', 'absolute' => true)
);
$base = $this->request->env('HTTPS') ? 'https://' : 'http://';
$base .= 'test.local';
$base .= $this->request->env('base');
$this->assertEqual($base . '/login', $result);
$result = Router::match('Sessions::add',
$this->request, array('scheme' => 'https://', 'absolute' => true)
);
$base = 'https://' . $this->request->env('HTTP_HOST');
$base .= $this->request->env('base');
$this->assertEqual($base . '/login', $result);
$result = Router::match('Sessions::add',
$this->request, array('scheme' => 'https://', 'absolute' => true)
);
$base = 'https://' . $this->request->env('HTTP_HOST');
$base .= $this->request->env('base');
$this->assertEqual($base . '/login', $result);
}