Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Passed
Push — master ( b6fc5f...138f00 )
by Jérémiah
03:34
created

GlobalIdTest   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2
Metric Value
wmc 8
lcom 1
cbo 2
dl 0
loc 58
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A testToGlobalId() 0 6 1
A testToGlobalIdWithTypeEmpty() 0 6 1
A testToGlobalIdWithIdEmpty() 0 6 1
A testToGlobalIdWithTypeAndIdEmpty() 0 6 1
A testFromGlobalId() 0 6 1
A testFromGlobalIdWithTypeEmpty() 0 6 1
A testFromGlobalIdWithIdEmpty() 0 6 1
A testFromGlobalIdWithTypeAndIdEmpty() 0 6 1
1
<?php
2
3
/*
4
 * This file is part of the OverblogGraphQLBundle package.
5
 *
6
 * (c) Overblog <http://github.com/overblog/>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Overblog\GraphQLBundle\Tests\Relay\Node;
13
14
use Overblog\GraphQLBundle\Relay\Node\GlobalId;
15
16
class GlobalIdTest extends \PHPUnit_Framework_TestCase
17
{
18
    public function testToGlobalId()
19
    {
20
        $globalId = GlobalId::toGlobalId('User', 15);
21
22
        $this->assertEquals(sprintf('User%s15', GlobalId::SEPARATOR), base64_decode($globalId));
23
    }
24
25
    public function testToGlobalIdWithTypeEmpty()
26
    {
27
        $globalId = GlobalId::toGlobalId('', 15);
28
29
        $this->assertEquals(sprintf('%s15', GlobalId::SEPARATOR), base64_decode($globalId));
30
    }
31
32
    public function testToGlobalIdWithIdEmpty()
33
    {
34
        $globalId = GlobalId::toGlobalId('User', null);
35
36
        $this->assertEquals(sprintf('User%s', GlobalId::SEPARATOR), base64_decode($globalId));
37
    }
38
39
    public function testToGlobalIdWithTypeAndIdEmpty()
40
    {
41
        $globalId = GlobalId::toGlobalId(null, null);
42
43
        $this->assertEquals(sprintf('%s', GlobalId::SEPARATOR), base64_decode($globalId));
44
    }
45
46
    public function testFromGlobalId()
47
    {
48
        $params = GlobalId::fromGlobalId('VXNlcjoxNQ==');
49
50
        $this->assertEquals(['type' => 'User', 'id' => 15], $params);
51
    }
52
53
    public function testFromGlobalIdWithTypeEmpty()
54
    {
55
        $params = GlobalId::fromGlobalId('OjE1=');
56
57
        $this->assertEquals(['type' => null, 'id' => 15], $params);
58
    }
59
60
    public function testFromGlobalIdWithIdEmpty()
61
    {
62
        $params = GlobalId::fromGlobalId('VXNlcjo=');
63
64
        $this->assertEquals(['type' => 'User', 'id' => null], $params);
65
    }
66
67
    public function testFromGlobalIdWithTypeAndIdEmpty()
68
    {
69
        $params = GlobalId::fromGlobalId('Og==');
70
71
        $this->assertEquals(['type' => null, 'id' => null], $params);
72
    }
73
}
74