Executes an action
If called from action() redirect will be issued by the response factory
If called as /action page handler response will be handled by \Elgg\Router
public function testCanNotExecuteActionWithoutActionFile() { $this->request = $this->prepareHttpRequest('action/no_file', 'POST', [], false, true); $this->assertTrue($this->actions->register('no_file', "{$this->actionsDir}/no_file.php", 'public')); $this->createService(); $result = $this->actions->execute('no_file', 'referrer'); $this->assertInstanceOf(ErrorResponse::class, $result); $this->assertEquals(ELGG_HTTP_NOT_IMPLEMENTED, $result->getStatusCode()); $this->assertEquals(elgg_echo('actionnotfound', ['no_file']), $result->getContent()); $this->assertEquals('referrer', $result->getForwardURL()); }