spec/HttpMethodsClientSpec.php
private function assert(HttpClient $client, RequestFactory $requestFactory, RequestInterface $request, ResponseInterface $response, string $method, string $body = null)
    {
        $client->sendRequest($request)->shouldBeCalled()->willReturn($response);
        $this->mockFactory($requestFactory, $request, strtoupper($method), $body);

        $this->$method(self::$requestData['uri'], self::$requestData['headers'], self::$requestData['body'])->shouldReturnAnInstanceOf(ResponseInterface::class);
    }
private function assert(HttpClient $client, RequestFactory $requestFactory, RequestInterface $request, ResponseInterface $response, string $method, string $body = null)
    {
        $client->sendRequest($request)->shouldBeCalled()->willReturn($response);
        $this->mockFactory($requestFactory, $request, strtoupper($method), $body);

        $this->$method(self::$requestData['uri'], self::$requestData['headers'], self::$requestData['body'])->shouldReturnAnInstanceOf(ResponseInterface::class);
    }
private function assert ( HttpClient $ client , RequestFactory $ requestFactory , RequestInterface $ request , ResponseInterface $ response , string $ method , string $ body = null ) { $ client -> sendRequest ( $ request ) -> shouldBeCalled ( ) -> willReturn ( $ response ) ; $ this -> mockFactory ( $ requestFactory , $ request , strtoupper ( $ method ) , $ body ) ; $ this -> $ method ( self :: $ requestData [ 'uri' ] , self :: $ requestData [ 'headers' ] , self :: $ requestData [ 'body' ] ) -> shouldReturnAnInstanceOf ( ResponseInterface :: class ) ; }
Run the actual test.

As there is no data provider in phpspec, we keep separate methods to get new mocks for each test.
Run the actual test .