public function testProcessWithRelativeAndPrefixedAttachment()
{
Router::scope('app', function () {
Router::connect('/home/welcome', array('Home::app'));
});
Router::scope('tests', function () {
Router::connect('/home/welcome', array('Home::tests'));
});
Router::connect('/home/welcome', array('Home::default'));
Router::attach('tests', array('absolute' => false, 'host' => 'tests.mysite.com', 'scheme' => 'http://', 'prefix' => '/prefix'));
Router::attach('app', array('absolute' => false, 'host' => 'app.mysite.com', 'scheme' => 'http://', 'prefix' => '/prefix'));
$request = new Request(array('url' => '/home/welcome'));
$result = Router::process($request);
$expected = array('controller' => 'Home', 'action' => 'default');
$this->assertEqual($expected, $result->params);
$this->assertIdentical(false, Router::scope());
Router::reset();
Router::scope('tests', function () {
Router::connect('/home/welcome', array('Home::tests'));
});
Router::scope('app', function () {
Router::connect('/home/welcome', array('Home::app'));
});
Router::connect('/home/welcome', array('Home::default'));
Router::attach('tests', array('absolute' => false, 'host' => 'tests.mysite.com', 'scheme' => 'http://', 'prefix' => '/prefix1'));
Router::attach('app', array('absolute' => false, 'host' => 'app.mysite.com', 'scheme' => 'http://', 'prefix' => '/prefix2'));
$request = new Request(array('url' => '/prefix1/home/welcome'));
$result = Router::process($request);
$expected = array('library' => 'tests', 'controller' => 'Home', 'action' => 'tests');
$this->assertEqual($expected, $result->params);
$this->assertEqual('tests', Router::scope());
}