Issues (9)

tests/StockTicker/Unit/WithFakeHttpClient.php (1 issue)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chemaclass\StockTickerTests\Unit;
6
7
use Symfony\Contracts\HttpClient\HttpClientInterface;
8
use Symfony\Contracts\HttpClient\ResponseInterface;
9
10
trait WithFakeHttpClient
11
{
12
    private function mockHttpClient(string $responseBody = ''): HttpClientInterface
13
    {
14
        $response = $this->createMock(ResponseInterface::class);
0 ignored issues
show
It seems like createMock() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

14
        /** @scrutinizer ignore-call */ 
15
        $response = $this->createMock(ResponseInterface::class);
Loading history...
15
        $response->method('getContent')->willReturn($responseBody);
16
17
        $httpClient = $this->createMock(HttpClientInterface::class);
18
        $httpClient->method('request')->willReturn($response);
19
20
        return $httpClient;
21
    }
22
}
23