public function testCanRespondToAjaxRequest()
{
$this->assertTrue($this->actions->register('output3', "{$this->actionsDir}/output3.php", 'public'));
$this->request = $this->prepareHttpRequest('action/output3', 'POST', [], 1, true);
$this->createService();
set_input('output', 'output3');
set_input('system_message', 'success');
$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'));
$this->assertContains('charset=utf-8', strtolower($response->headers->get('Content-Type')));
$output = json_encode(['output' => 'output3', 'status' => 0, 'system_messages' => ['error' => [], 'success' => ['success']], 'current_url' => current_page_url(), 'forward_url' => $this->request->headers->get('Referer')]);
$this->assertEquals($output, $response->getContent());
}