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