我正在尝试增加 Codeception REST 超时,但它似乎不起作用。
这就是我所拥有的
class_name: ApiTester
modules:
enabled:
- \Helper\Api:
- REST:
depends: PhpBrowser
timeout: 90
我遇到超时错误
[GuzzleHttp\Exception\ConnectException] cURL 错误 28:操作在 30001 毫秒后超时,收到 0 字节
我做错了什么?
我也遇到这个问题了。这是我的修复
接受.suite.yml
# Codeception Test Suite Configuration
# suite for acceptance tests.
# perform tests in browser using the WebDriver or PhpBrowser.
# If you need both WebDriver and PHPBrowser tests - create a separate suite.
class_name: AcceptanceTester
modules:
enabled:
- PhpBrowser
- REST
config:
REST:
timeout: 90 # or 90000 the same result
PhpBrowser:
url: 'http://YOUR_URL_TO_YOUR_PUBLIC_FOLDER/public'
curl:
CURLOPT_TIMEOUT: 300 // in Seconds
我的问题是,我只将 REST 放入其中,并“取决于”PhpBrowser,但您需要配置 PhpBrowser 来设置超时。
我希望我能提供帮助,并对我的英语不好感到抱歉:)
谢谢托马斯,我已将其添加到我的 api.suite.yml 文件中并且它有效。
class_name: ApiTester
modules:
enabled:
- \Helper\Api
- REST
- PhpBrowser
config:
REST:
depends: PhpBrowser
timeout: 90
PhpBrowser:
url: ''
curl:
CURLOPT_TIMEOUT: 90
对于 Codeception 4。
添加到 api.suite.yml 或 Acceptance.suite.yml 类似这样的内容
actor: ApiTester
modules:
enabled:
- PhpBrowser:
url: https://localhost/index-test.php
timeout: 5
# curl:
# CURLOPT_RETURNTRANSFER: true // add some curl option
- REST:
depends: PhpBrowser
url: https://localhost/index-test.php
part: Json
- Yii2:
configFile: 'tests/config/test.php'
part: [orm, fixtures]