Elgg\ActionsServiceTest::testCanRespondToNonAjaxRequest PHP Method

testCanRespondToNonAjaxRequest() public method

Non-xhr call to an action must always result in a redirect This test will implement the flow without triggering ajax forward hook
    public function testCanRespondToNonAjaxRequest()
    {
        $this->assertTrue($this->actions->register('output3', "{$this->actionsDir}/output3.php", 'public'));
        $this->request = $this->prepareHttpRequest('action/output3', 'POST', [], false, true);
        $this->createService();
        set_input('output', 'output3');
        set_input('system_message', 'success');
        $this->route();
        $response = _elgg_services()->responseFactory->getSentResponse();
        $this->assertInstanceOf(RedirectResponse::class, $response);
        $this->assertEquals(ELGG_HTTP_FOUND, $response->getStatusCode());
        $this->assertEquals($this->request->headers->get('Referer'), $response->getTargetURL());
        // Symfony adds html content with refresh meta tag
        //$this->assertEquals('', $response->getContent());
    }
ActionsServiceTest