Elgg\RouterTest::testCanRespondToAjax2ViewRequestForARegisteredViewWhichForwards PHP Method

testCanRespondToAjax2ViewRequestForARegisteredViewWhichForwards() public method

    public function testCanRespondToAjax2ViewRequestForARegisteredViewWhichForwards()
    {
        $vars = ['output' => 'hello', 'forward_url' => 'forwards', 'forward_reason' => ELGG_HTTP_BAD_REQUEST, 'error' => 'error'];
        $this->request = $this->prepareHttpRequest('ajax/view/forwards', 'GET', $vars, 2);
        $this->createService();
        elgg_register_ajax_view('forwards');
        $this->route();
        $response = _elgg_services()->responseFactory->getSentResponse();
        $this->assertInstanceOf(Response::class, $response);
        $this->assertEquals(ELGG_HTTP_BAD_REQUEST, $response->getStatusCode());
        $this->assertContains('application/json', $response->headers->get('Content-Type'));
        /**
         * @todo: decide what the output should be
         * Do we use the buffer output when responding with error to Ajax2?
         * See #9798
         */
        $output = json_encode(['error' => 'hello'], ELGG_JSON_ENCODING);
        $this->assertEquals($output, $response->getContent());
        $this->markTestIncomplete();
    }
RouterTest