lithium\tests\cases\net\http\RouterTest::testRouteMatchAbsoluteUrl PHP 메소드

testRouteMatchAbsoluteUrl() 공개 메소드

Tests matching routes and returning an absolute (protocol + hostname) URL.
    public function testRouteMatchAbsoluteUrl()
    {
        Router::connect('/login', array('controller' => 'sessions', 'action' => 'add'));
        $result = Router::match('Sessions::add', $this->request);
        $base = $this->request->env('base');
        $this->assertIdentical($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->assertIdentical($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->assertIdentical($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->assertIdentical($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->assertIdentical($base . '/login', $result);
    }
RouterTest