jeudi 3 septembre 2015

Codeception - make API call on _beforeSuite

I am trying to make an API call at the beginning of each test suite but am not finding a way to do it. In my module I have overloaded the _beforeSuite method but when I try to call sendPost from the REST module, I get errors. My module class looks like this:

class CoolApi extends \Codeception\Module
{
    public function _beforeSuite(array $settings) {
        $I = $this->getModule('REST');

        $I->sendPost('my-url-yay/', [
            'ids' => '1,2,3',
        ]);
    }

This gives me the PHP error:

Call to a member function request() on a non-object in /...../vendor/codeception/codeception/src/Codeception/Module/REST.php:476

How can I send a post request in _beforeSuite?

Aucun commentaire:

Enregistrer un commentaire