> 测试代码,curl适配器运行正常
```php
$client = new Client([
'adapter'=>'php'
]);
$req = $client->get("http://www.baidu.com");
var_dump($req->getResponse()->getStatusCode());
结果:
2018/04/09 14:52:38 [DEBUG] [Application] Trigger the event applicationLoader
PHPUnit 7.0.3 by Sebastian Bergmann and contributors.
R 1 / 1 (100%)int(200)
Time: 762 ms, Memory: 14.00MB
There was 1 risky test:
1) Swoft\Test\Cases\WeChat\AccessTokenTest::testGetToken
This test did not perform any assertions
OK, but incomplete, skipped, or risky tests!
Tests: 1, Assertions: 0, Risky: 1.
php --ri swoole
)php -v
)swoole
$client = new Client([ 'adapter'=>'co' ]); $req = $client->get("http://www.baidu.com"); var_dump($req->getResponse()->getStatusCode());
结果出错: PHPUnit 7.0.3 by Sebastian Bergmann and contributors.
E 1 / 1 (100%)
Time: 657 ms, Memory: 14.00MB
There was 1 error:
1) Swoft\Test\Cases\WeChat\AccessTokenTest::testGetToken InvalidArgumentException: Invalid http client adapter
/Users/sl/Code/swoft/vendor/swoft/http-client/src/Client.php:250 /Users/sl/Code/swoft/vendor/swoft/http-client/src/Client.php:58 /Users/sl/Code/swoft/test/Cases/WeChat/AccessTokenTest.php:35
ERRORS! Tests: 1, Assertions: 0, Errors: 1
改为 swoole $client = new Client([ 'adapter'=>'swoole' ]); $req = $client->get("http://www.baidu.com"); var_dump($req->getResponse()->getStatusCode()); 结果: 2018/04/09 14:55:32 [DEBUG] [Application] Trigger the event applicationLoader PHPUnit 7.0.3 by Sebastian Bergmann and contributors.
[1] 27056 segmentation fault vendor/bin/phpunit test/Cases/WeChat/AccessTokenTest.php
改为 coroutine $client = new Client([ 'adapter'=>'coroutine' ]); $req = $client->get("http://www.baidu.com"); var_dump($req->getResponse()->getStatusCode());
结果与上面 swoole错误一样 2018/04/09 14:56:27 [DEBUG] [Application] Trigger the event applicationLoader PHPUnit 7.0.3 by Sebastian Bergmann and contributors.
[1] 27088 segmentation fault vendor/bin/phpunit test/Cases/WeChat/AccessTokenTest.php
这几个参数的由来是看的client 源码