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.

LinksFactoryTest::test()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 46
Code Lines 33

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 46
c 0
b 0
f 0
rs 8.9411
cc 1
eloc 33
nc 1
nop 0
1
<?php
2
3
namespace Hateoas\Tests\Factory;
4
5
use Hateoas\Configuration\Relation;
6
use Hateoas\Factory\LinksFactory;
7
use Hateoas\Model\Link;
8
use Hateoas\Tests\TestCase;
9
use JMS\Serializer\SerializationContext;
10
11
class LinksFactoryTest extends TestCase
12
{
13
    public function test()
14
    {
15
        $object = new \StdClass();
16
        $context = SerializationContext::create();
17
18
        $relations = array(
19
            new Relation('self', '/users/1'),
20
            new Relation('manager', '/users/2'),
21
        );
22
        $link = new Link('', '');
23
24
        $relationsRepositoryProphecy = $this->prophesize('Hateoas\Configuration\RelationsRepository');
25
        $relationsRepositoryProphecy
26
            ->getRelations($object)
27
            ->willReturn($relations)
28
            ->shouldBeCalledTimes(1)
29
        ;
30
        $linkFactoryProphecy = $this->prophesize('Hateoas\Factory\LinkFactory');
31
        $linkFactoryProphecy
32
            ->createLink($object, $relations[1])
33
            ->willReturn($link)
34
            ->shouldBeCalledTimes(1)
35
        ;
36
        $exclusionManagerProphecy = $this->prophesize('Hateoas\Serializer\ExclusionManager');
37
        $exclusionManagerProphecy
38
            ->shouldSkipLink($object, $relations[0], $context)
39
            ->willReturn(true)
40
            ->shouldBeCalledTimes(1)
41
        ;
42
        $exclusionManagerProphecy
43
            ->shouldSkipLink($object, $relations[1], $context)
44
            ->willReturn(false)
45
            ->shouldBeCalledTimes(1)
46
        ;
47
48
        $linksFactory = new LinksFactory(
49
            $relationsRepositoryProphecy->reveal(),
50
            $linkFactoryProphecy->reveal(),
51
            $exclusionManagerProphecy->reveal()
52
        );
53
54
        $links = $linksFactory->create($object, $context);
55
56
        $this->assertCount(1, $links);
57
        $this->assertContains($link, $links);
58
    }
59
}
60