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

StatisticsTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 30
c 0
b 0
f 0
wmc 1
lcom 0
cbo 3
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testDid() 0 25 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yproximite\WannaSpeakBundle\Tests\Api;
6
7
use PHPUnit\Framework\TestCase;
8
use Symfony\Component\HttpClient\Response\MockResponse;
9
use Yproximite\WannaSpeakBundle\Api\Statistics;
10
use Yproximite\WannaSpeakBundle\Tests\HttpClientTestTrait;
11
12
class StatisticsTest extends TestCase
13
{
14
    use HttpClientTestTrait;
15
16
    public function testDid(): void
17
    {
18
        $statistics = new Statistics(
19
            $this->createHttpClient(new MockResponse(
20
                (string) json_encode($responseData = [
21
                    'error' => null,
22
                    'data'  => [
23
                        'calls' => [
24
                            [
25
                                'starttime' => '2020-01-01 16:28:49',
26
                                'source'    => 'unknown',
27
                                'duration'  => 30,
28
                                // ...
29
                            ],
30
                        ],
31
                    ],
32
                ])
33
            ))
34
        );
35
36
        static::assertSame(
37
            $responseData,
38
            $statistics->did()
39
        );
40
    }
41
}
42