Elgg\RouterTest::testCanRespondToNonAjaxRequestThroughRouteHook PHP Method

testCanRespondToNonAjaxRequestThroughRouteHook() public method

    public function testCanRespondToNonAjaxRequestThroughRouteHook()
    {
        $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']);
            echo 'good bye';
            return false;
        });
        $this->request = $this->prepareHttpRequest('foo/bar/baz', 'GET');
        $this->createService();
        $this->route();
        $response = _elgg_services()->responseFactory->getSentResponse();
        $this->assertInstanceOf(Response::class, $response);
        $this->assertEquals(ELGG_HTTP_OK, $response->getStatusCode());
        $this->assertEquals('good bye', $response->getContent());
    }
RouterTest