lithium\tests\cases\net\http\RouterTest::testProcessWithAbsoluteAttachmentAndLibrary PHP Метод

testProcessWithAbsoluteAttachmentAndLibrary() публичный Метод

    public function testProcessWithAbsoluteAttachmentAndLibrary()
    {
        $request = new Request(array('url' => '/hello_world/index', 'env' => array('HTTP_HOST' => 'bob.amiga.com', 'HTTPS' => false)));
        Router::attach('app', array('absolute' => true, 'host' => '{:subdomain}.amiga.{:tld}', 'scheme' => 'http', 'library' => 'other'));
        Router::scope('app', function () {
            Router::connect('/hello_world/index', array('HelloWorld::index'));
            Router::connect('/{:controller}/{:action}');
        });
        Router::process($request);
        $expected = array('library' => 'other', 'controller' => 'HelloWorld', 'action' => 'index', 'subdomain' => 'bob', 'tld' => 'com');
        $this->assertEqual($expected, $request->params);
        $result = Router::attached('app');
        $this->assertEqual($expected, $result['values']);
        $request = new Request(array('url' => '/posts/index', 'env' => array('HTTP_HOST' => 'bob.amiga.com', 'HTTPS' => false)));
        Router::process($request);
        $expected = array('library' => 'other', 'controller' => 'Posts', 'action' => 'index', 'subdomain' => 'bob', 'tld' => 'com');
        $this->assertEqual($expected, $request->params);
        $result = Router::attached('app');
        $this->assertEqual($expected, $result['values']);
    }
RouterTest