Elgg\RouterTest::testCanRespondToNonAjaxRequestFromErrorResponseBuilder PHP Method

testCanRespondToNonAjaxRequestFromErrorResponseBuilder() public method

    public function testCanRespondToNonAjaxRequestFromErrorResponseBuilder()
    {
        $this->request = $this->prepareHttpRequest('foo/bar/baz', 'GET');
        $this->createService();
        elgg_register_page_handler('foo', function ($segments, $identifier) {
            $this->assertEquals(['bar', 'baz'], $segments);
            $this->assertEquals('foo', $identifier);
            return elgg_error_response('', 'phpunit', ELGG_HTTP_NOT_FOUND);
        });
        $this->assertTrue($this->route());
        $response = _elgg_services()->responseFactory->getSentResponse();
        $this->assertInstanceOf(Response::class, $response);
        $this->assertEquals(ELGG_HTTP_NOT_FOUND, $response->getStatusCode());
        $error_page = elgg_view_resource('error', ['type' => (string) ELGG_HTTP_NOT_FOUND]);
        $this->assertEquals($error_page, $response->getContent());
    }
RouterTest