try to testing request as POST

stewestw
Member | 42
+
0
-

hi,
please can anyone help me with setting test as POST?

im getting presenter in test like:

$presenterFactory = $this->container->getByType('Nette\Application\IPresenterFactory');
        $this->presenter = $presenterFactory->createPresenter($presName);

setting test:

public function test($action, $method = 'GET', $params = array(), $post = array(), $files = array(), $flags = array()) {
        $params['action'] = $action;
        $request = new \Nette\Application\Request($this->presName, $method, $params, $post, $files, $flags);
        return $this->presenter->run($request);
    }

and calling it like:

$response = $this->tester->test('edit', 'POST', ['id' => $testItem->id], $data, [], ['X-Requested-With' => 'XMLHttpRequest']);

but it always send data as GET.
thank you

Last edited by stewestw (2018-01-11 14:04)