public function testCanRespondToNonAjaxRequestInNonDefaultViewtype()
{
$this->request = $this->prepareHttpRequest('phpunit', 'GET', ['view' => 'json']);
$this->createService();
elgg_register_page_handler('phpunit', function () {
$output = elgg_view('response');
return elgg_ok_response($output);
});
$this->assertTrue($this->route());
$response = _elgg_services()->responseFactory->getSentResponse();
$this->assertInstanceOf(Response::class, $response);
$this->assertEquals(ELGG_HTTP_OK, $response->getStatusCode());
$this->assertEquals(elgg_view('response', [], false, false, 'json'), $response->getContent());
$this->assertContains('application/json', $response->headers->get('Content-Type'));
$this->assertContains('charset=utf-8', strtolower($response->headers->get('Content-Type')));
}