Completed
Pull Request — master (#29)
by Hugo
01:27
created

StatisticsSpec::it_is_initializable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace spec\Yproximite\WannaSpeakBundle\Api;
6
7
use PhpSpec\ObjectBehavior;
8
use Symfony\Contracts\HttpClient\ResponseInterface;
9
use Yproximite\WannaSpeakBundle\Api\Statistics;
10
use Yproximite\WannaSpeakBundle\Api\StatisticsInterface;
11
use Yproximite\WannaSpeakBundle\HttpClientInterface;
12
13
class StatisticsSpec extends ObjectBehavior
14
{
15
    public function it_is_initializable()
16
    {
17
        $this->shouldHaveType(Statistics::class);
18
    }
19
20 View Code Duplication
    public function let(HttpClientInterface $client, ResponseInterface $response): void
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
21
    {
22
        $this->beConstructedWith($client);
23
24
        // Since we are in spec, the response content will always be the, see PHPUnit tests for real response asserting.
25
        $response
26
            ->toArray()
27
            ->willReturn(['error' => null, 'data' => [/* ... */]]);
28
    }
29
30
    public function it_should_get_stats(HttpClientInterface $client, ResponseInterface $response)
31
    {
32
        $client
33
            ->request(StatisticsInterface::API, 'did', [
34
                'tag1' => '12345',
35
            ])
36
            ->shouldBeCalled()
37
            ->willReturn($response);
38
39
        $this
40
            ->did(['tag1' => '12345'])
41
            ->shouldBe(['error' => null, 'data' => [/* ... */]]);
42
    }
43
}
44