Elgg\ActionsServiceTest::testCanRespondToAjax2Request PHP Метод

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

This test will implement the flow without triggering ajax forward hook
    public function testCanRespondToAjax2Request()
    {
        $this->assertTrue($this->actions->register('output3', "{$this->actionsDir}/output3.php", 'public'));
        $this->request = $this->prepareHttpRequest('action/output3', 'POST', [], 2, 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'));
        // Ajax API doesn't set charset
        //$this->assertContains('charset=utf-8', strtolower($response->headers->get('Content-Type')));
        $output = json_encode(['value' => 'output3', '_elgg_msgs' => ['success' => ['success']], '_elgg_deps' => []]);
        $this->assertEquals($output, $response->getContent());
    }
ActionsServiceTest