1
我試圖在每個測試套件開始時進行API調用,但沒有找到一種方法來做到這一點。在我的模塊中,我重載了_beforeSuite
方法,但是當我嘗試從REST模塊調用sendPost
時,出現錯誤。我模塊類看起來是這樣的:Codeception - 在_beforeSuite上調用API調用
class CoolApi extends \Codeception\Module
{
public function _beforeSuite(array $settings) {
$I = $this->getModule('REST');
$I->sendPost('my-url-yay/', [
'ids' => '1,2,3',
]);
}
這使我的PHP錯誤:
Call to a member function request() on a non-object in /...../vendor/codeception/codeception/src/Codeception/Module/REST.php:476
我如何可以發送_beforeSuite POST請求?