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

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

    public function testCanRespondWithErrorToAjax2ViewRequestForUnallowedView()
    {
        $this->request = $this->prepareHttpRequest('ajax/view/unallowed', 'GET', [], 2);
        $this->createService();
        $this->route();
        $response = _elgg_services()->responseFactory->getSentResponse();
        $this->assertInstanceOf(Response::class, $response);
        $this->assertEquals(ELGG_HTTP_FORBIDDEN, $response->getStatusCode());
        $output = json_encode(['error' => "Ajax view 'unallowed' was not registered"], ELGG_JSON_ENCODING);
        // Symfony JsonResponse
        $this->assertEquals($output, $response->getContent());
    }
RouterTest