Elgg\RouterTest::testCanRespondToNonAjaxRequestForPageThatForwardsToErrorPage PHP Метод

testCanRespondToNonAjaxRequestForPageThatForwardsToErrorPage() публичный Метод

    public function testCanRespondToNonAjaxRequestForPageThatForwardsToErrorPage()
    {
        $this->request = $this->prepareHttpRequest('phpunit', 'GET');
        $this->createService();
        elgg_register_page_handler('phpunit', function () {
            _elgg_services()->responseFactory->redirect('error', ELGG_HTTP_NOT_FOUND);
            return elgg_ok_response('foo');
        });
        $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