调用 1 次时,方法名称的期望失败为“创建”

问题描述

我使用了 guzzleHttp 客户端作为补丁方法。现在我已经为这个补丁方法添加了集成测试。运行命令 ./vendor/bin/PHPunit tests/AbcTest.PHP 时出错:

Expectation Failed for method name is "create" when invoked 1 time(s). Parameter 1 for invocation RequestBuilder::create('PATCH',$url,Array(..),null): Psr\Http\Message\RequestInterface does not match expected value.

AbcTest 文件调用这个 Api.PHP 文件

我在 Api.PHP 中的代码是:

use GuzzleHttp\Guzzle\ClientInterface;
use Http\Client\Common\PluginClient;
Class Api
{
    protected $httpClient;
    public function __construct($httpClient,RequestBuilder $requestBuilder)
    {
        $this->httpClient = $httpClient;
        $this->requestBuilder = $requestBuilder;
    }

    protected function methodPatch(string $path,array $params = [],array $headers = [])
    {
        $response =  $this->httpClient->sendRequest(
            $this->requestBuilder->create('PATCH',[
               'headers' => $headers 
            ])
        );
    }
}

谁能帮我解决GuzzleHttp\Guzzle\ClientInterface

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)