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
Pull Request — master (#1)
by Pascal
07:37
created

ServiceTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 41
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testVersionCanBeChanged() 0 9 1
A testInitializesWithOneError() 0 12 1
A testInitializesWithMultipleErrors() 0 14 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Saikootau\ApiBundle\Tests\Resource;
6
7
use DateTimeInterface;
8
use PHPUnit\Framework\TestCase;
9
use Saikootau\ApiBundle\Resource\Error;
10
use Saikootau\ApiBundle\Resource\Request;
11
use Saikootau\ApiBundle\Resource\Service;
12
13
class ServiceTest extends TestCase
14
{
15
    public function testInitializesWithOneError(): void
16
    {
17
        $request = $this->prophesize(Request::class)->reveal();
18
        $error = $this->prophesize(Error::class)->reveal();
19
20
        $service = new Service($request, $error);
21
22
        $this->assertSame(Service::DEFAULT_VERSION, $service->getVersion());
23
        $this->assertInstanceOf(DateTimeInterface::class, $service->getTimestamp());
24
        $this->assertSame($request, $service->getRequest());
25
        $this->assertCount(1, $service->getErrors());
26
        $this->assertContains($error, $service->getErrors());
27
    }
28
29
    public function testInitializesWithMultipleErrors(): void
30
    {
31
        $request = $this->prophesize(Request::class)->reveal();
32
        $error = $this->prophesize(Error::class)->reveal();
33
        $error2 = $this->prophesize(Error::class)->reveal();
34
35
        $service = new Service($request, $error, $error2);
36
37
        $this->assertSame(Service::DEFAULT_VERSION, $service->getVersion());
38
        $this->assertInstanceOf(DateTimeInterface::class, $service->getTimestamp());
39
        $this->assertSame($request, $service->getRequest());
40
        $this->assertCount(2, $service->getErrors());
41
        $this->assertContains($error, $service->getErrors());
42
        $this->assertContains($error2, $service->getErrors());
43
    }
44
45
    public function testVersionCanBeChanged(): void
46
    {
47
        $request = $this->prophesize(Request::class)->reveal();
48
        $error = $this->prophesize(Error::class)->reveal();
49
50
        $service = new Service($request, $error);
51
52
        $service->setVersion('2.0');
53
        $this->assertSame('2.0', $service->getVersion());
54
    }
55
}
56