Completed
Pull Request — master (#339)
by Alejandro
18:21 queued 08:22
created

ApiTestCase::setApiClient()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
nc 1
nop 1
dl 0
loc 3
c 0
b 0
f 0
cc 1
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace ShlinkioTest\Shlink\Common\ApiTest;
5
6
use Fig\Http\Message\RequestMethodInterface;
7
use Fig\Http\Message\StatusCodeInterface;
8
use GuzzleHttp\ClientInterface;
9
use PHPUnit\Framework\TestCase;
10
use Psr\Http\Message\ResponseInterface;
11
12
abstract class ApiTestCase extends TestCase implements StatusCodeInterface, RequestMethodInterface
13
{
14
    /** @var ClientInterface */
15
    private static $client;
16
17
    public static function setApiClient(ClientInterface $client): void
18
    {
19
        self::$client = $client;
20
    }
21
22
    /**
23
     * @throws \GuzzleHttp\Exception\GuzzleException
24
     */
25
    protected function callApi(string $method, string $uri, array $options = []): ResponseInterface
26
    {
27
        return self::$client->request($method, $uri, $options);
28
    }
29
}
30