Codeception REST API 调用 HTTPS url

Codeception REST API call for HTTPS url

我正在寻找一种代码接受配置,以使用代码接受 REST 模块对安全 https url 进行调用。

例如我想查看我们的 slack bot 的在线状态:

    $slackApiUrl = 'https://slack.com/api/users.getPresence';

    $params = [
        'token' => $apiToken,
        'user' => $botUserId,
    ];

    $I->sendPOST($slackApiUrl, $params);

当我执行测试时,我会收到类似

的 guzzle 错误

[GuzzleHttp\Exception\ConnectException] cURL error 35: SSL: CA certificate set, but certificate verification is disabled (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

我知道,codeception 默认关闭 https 安全 urls 但是 我如何在需要时激活 https?

我的suite.yml:

class_name: AcceptanceTester
modules:
    enabled:
        - REST:
            url: *****
            depends: PhpBrowser
        - PhpBrowser
        - Asserts
        - \Helper\Acceptance

我可以自己回答。这是密码版本。更新到 Codeception v2.2 后,相同的测试按预期工作。

Codeception PHP Testing Framework v2.2.8
Powered by PHPUnit 5.7.15 by Sebastian Bergmann and contributors.
[Groups] slack

Acceptance (live) Tests (1) --------------------------------------------------------------------------
Modules: REST, PhpBrowser, Asserts, \Helper\Acceptance
------------------------------------------------------------------------------------------------------
slackCest: Check slack bot online status
  I send post "https://slack.com/api/users.getPresence"
[...]
  [Response] {"ok":true,"presence":"active"}
 I am going to Check SlackBot online status
 I see response contains json {"ok":true,"presence":"active"}
 PASSED