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.

UrlGeneratorRegistryTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A mockUrlGenerator() 0 4 1
A test() 0 23 2
1
<?php
2
3
namespace Hateoas\Tests\UrlGenerator;
4
5
use Hateoas\Tests\TestCase;
6
use Hateoas\UrlGenerator\UrlGeneratorRegistry;
7
8
class UrlGeneratorRegistryTest extends TestCase
9
{
10
    public function test()
11
    {
12
        $defaultUrlGenerator = $this->mockUrlGenerator();
13
        $registry = new UrlGeneratorRegistry($defaultUrlGenerator);
14
15
        $this->assertSame($defaultUrlGenerator, $registry->get(UrlGeneratorRegistry::DEFAULT_URL_GENERATOR_KEY));
16
        $this->assertSame($defaultUrlGenerator, $registry->get());
17
18
        $exception = null;
19
        try {
20
            $registry->get('foo');
21
        } catch (\Exception $e) {
22
            $exception = $e;
23
        }
24
        $this->assertInstanceOf('InvalidArgumentException', $exception);
25
        $this->assertSame(
26
            'The "foo" url generator is not set. Available url generators are: default.',
27
            $exception->getMessage()
28
        );
29
30
        $registry->set('foo', $fooUrlGenerator = $this->mockUrlGenerator());
31
        $this->assertSame($fooUrlGenerator, $registry->get('foo'));
32
    }
33
34
    private function mockUrlGenerator()
35
    {
36
        return $this->prophesize('Hateoas\UrlGenerator\UrlGeneratorInterface')->reveal();
37
    }
38
}
39