Elgg\RouterTest::testCanRespondToAjax2ViewRequestForJS PHP Method

testCanRespondToAjax2ViewRequestForJS() public method

    public function testCanRespondToAjax2ViewRequestForJS()
    {
        $this->request = $this->prepareHttpRequest('ajax/view/js/javascript.js', 'GET', [], 2);
        $this->createService();
        $this->route();
        $response = _elgg_services()->responseFactory->getSentResponse();
        $this->assertInstanceOf(Response::class, $response);
        $this->assertEquals(ELGG_HTTP_OK, $response->getStatusCode());
        $this->assertContains('application/json', $response->headers->get('Content-Type'));
        $output = json_encode(['value' => file_get_contents($this->viewsDir . '/default/javascript.js'), '_elgg_msgs' => (object) [], '_elgg_deps' => []], ELGG_JSON_ENCODING);
        $this->assertEquals($output, $response->getContent());
    }
RouterTest