Passed
Push — master ( c21964...371444 )
by Alessandro
01:05 queued 18s
created

TrelloApiClientMock::createRequest()   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 1
1
<?php
2
3
4
namespace Tests\Client;
5
6
use PHPUnit\Framework\TestCase;
7
use TrelloCycleTime\Client\TrelloApiClient;
8
9
class TrelloApiClientTest extends TestCase
10
{
11
    public function testGetAllCards()
12
    {
13
        $trelloApiClient = new TrelloApiClientMock('apiKey', 'token');
14
        $response = $trelloApiClient->findAllCards('boardId');
15
16
        $this->assertEquals(
17
            [
18
                [
19
                    'foo' => 'bar'
20
                ]
21
            ], $response);
22
    }
23
24 View Code Duplication
    public function testFindCreationCards()
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...
25
    {
26
        $trelloApiClient = new TrelloApiClientMock('apiKey', 'token');
27
        $response = $trelloApiClient->findCreationCard('cardId');
28
29
        $this->assertEquals(
30
            [
31
                [
32
                    'foo' => 'bar'
33
                ]
34
            ], $response);
35
    }
36
37 View Code Duplication
    public function testFindAllCardHistory()
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...
38
    {
39
        $trelloApiClient = new TrelloApiClientMock('apiKey', 'token');
40
        $response = $trelloApiClient->findAllCardHistory('cardId');
41
42
        $this->assertEquals(
43
            [
44
                [
45
                    'foo' => 'bar'
46
                ]
47
            ], $response);
48
    }
49
}
50
51
class TrelloApiClientMock extends TrelloApiClient
52
{
53
    public function createRequest(string $url)
54
    {
55
        return '[{"foo":"bar"}]';
56
    }
57
}