GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( dd680f...a61514 )
by Christian
01:32
created

CountryServiceTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testItIsInstantiable() 0 6 1
A testSearch() 0 23 1
1
<?php
2
3
/*
4
 * (c) Christian Gripp <[email protected]>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Core23\SetlistFm\Tests\Service;
11
12
use Core23\SetlistFm\Connection\ConnectionInterface;
13
use Core23\SetlistFm\Service\CountryService;
14
use PHPUnit\Framework\TestCase;
15
16
class CountryServiceTest extends TestCase
17
{
18
    private $connection;
19
20
    protected function setUp()
21
    {
22
        $this->connection =  $this->prophesize(ConnectionInterface::class);
23
    }
24
25
    public function testItIsInstantiable(): void
26
    {
27
        $service = new CountryService($this->connection->reveal());
28
29
        $this->assertNotNull($service);
30
    }
31
32
    public function testSearch(): void
33
    {
34
        $rawResponse = <<<'EOD'
35
                    {
36
                      "country" : [ {
37
                        "code" : "US",
38
                        "name" : "United States"
39
                      }],
40
                      "total" : 1,
41
                      "page" : 1,
42
                      "itemsPerPage" : 20
43
                    }
44
EOD;
45
46
        $this->connection->call('search/countries')
47
            ->willReturn(json_decode($rawResponse, true))
48
        ;
49
50
        $service = new CountryService($this->connection->reveal());
51
        $result  = $service->search();
52
53
        $this->assertCount(1, $result);
54
    }
55
}
56