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.

RelationProviderTest::test()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 41
Code Lines 26

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 41
c 0
b 0
f 0
rs 8.8571
cc 1
eloc 26
nc 1
nop 0
1
<?php
2
3
namespace Hateoas\Tests\Configuration\Provider;
4
5
use Hateoas\Configuration\Relation;
6
use Hateoas\Configuration\RelationProvider as RelationProviderConfiguration;
7
use Hateoas\Configuration\Provider\RelationProvider;
8
use Hateoas\Tests\TestCase;
9
use Prophecy\Argument;
10
11
class RelationProviderTest extends TestCase
12
{
13
    public function test()
14
    {
15
        $relationProviders = array(
16
            new RelationProviderConfiguration('getRelations'),
17
            new RelationProviderConfiguration('Class:getRelations'),
18
        );
19
        $relations1 = array($relation1 = new Relation('foo'));
20
        $relations2 = array($relation2 = new Relation('bar'));
21
22
        $classMetadataProphecy = $this->prophesize('Hateoas\Configuration\Metadata\ClassMetadataInterface');
23
        $classMetadataProphecy
24
            ->getRelationProviders()
25
            ->willReturn($relationProviders)
26
        ;
27
28
        $metadataFactoryProphecy = $this->prophesize('Metadata\MetadataFactoryInterface');
29
        $metadataFactoryProphecy
30
            ->getMetadataForClass('stdClass')
31
            ->willReturn($classMetadataProphecy->reveal())
32
        ;
33
34
        $resolverProphecy = $this->prophesize('Hateoas\Configuration\Provider\Resolver\RelationProviderResolverInterface');
35
        $resolverProphecy
36
            ->getRelationProvider(Argument::which('getName', 'getRelations'), Argument::any())
37
            ->willReturn(function () use ($relations1) {
38
                return $relations1;
39
            })
40
        ;
41
        $resolverProphecy
42
            ->getRelationProvider(Argument::which('getName', 'Class:getRelations'), Argument::any())
43
            ->willReturn(function () use ($relations2) {
44
                return $relations2;
45
            })
46
        ;
47
48
        $relationProvider = new RelationProvider($metadataFactoryProphecy->reveal(), $resolverProphecy->reveal());
49
50
        $object = new \StdClass();
51
52
        $this->assertSame([$relation1, $relation2], $relationProvider->getRelations($object));
53
    }
54
}
55