Elgg\RouterTest::testCanRedirectNonAjaxRequestFromRouteHook PHP Method

testCanRedirectNonAjaxRequestFromRouteHook() public method

    public function testCanRedirectNonAjaxRequestFromRouteHook()
    {
        $this->hooks->registerHandler('route', 'foo', function ($hook, $type, $return, $params) {
            $this->assertEquals($return, $params);
            $this->assertEquals('foo', $return['identifier']);
            $this->assertEquals(['bar', 'baz'], $return['segments']);
            _elgg_services()->responseFactory->redirect('foo2/bar2/baz2');
            return false;
        });
        $this->request = $this->prepareHttpRequest('foo/bar/baz', 'GET');
        $this->createService();
        $this->assertTrue($this->route());
        $response = _elgg_services()->responseFactory->getSentResponse();
        $this->assertInstanceOf(RedirectResponse::class, $response);
        $this->assertEquals(ELGG_HTTP_FOUND, $response->getStatusCode());
        $this->assertEquals(elgg_normalize_url('foo2/bar2/baz2'), $response->getTargetUrl());
    }
RouterTest