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

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
См. также: action
public execute ( string $action, string $forwarder = "" ) : Elgg\Http\ResponseBuilder | null
$action string Action name
$forwarder string URL to forward to after completion
Результат Elgg\Http\ResponseBuilder | null
Пример #1
0
 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());
 }