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 (#51)
by joseph
102:38 queued 99:24
created

TypeHelperTest::setup()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
c 0
b 0
f 0
rs 10
cc 1
eloc 1
nc 1
nop 0
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\CodeGeneration;
4
5
use EdmondsCommerce\DoctrineStaticMeta\MappingHelper;
6
use PHPUnit\Framework\TestCase;
7
8
class TypeHelperTest extends TestCase
9
{
10
    /**
11
     * @var TypeHelper
12
     */
13
    private $helper;
14
15
    public function setup()
16
    {
17
        $this->helper = new TypeHelper();
18
    }
19
20
    public function testGetTypeWorksAsExpected()
21
    {
22
        $expectedTypesToVars = [
23
            'string' => 'string',
24
            'float'  => 1.01,
25
            'int'    => 2,
26
            'bool'   => true,
27
            'null'   => null,
28
        ];
29
        foreach ($expectedTypesToVars as $expected => $var) {
30
            $this->assertSame($expected, $this->helper->getType($var));
31
        }
32
    }
33
34
    public function testTypeNormaliserWorksAsExpected()
35
    {
36
        $defaultValuesToTypes = [
37
            MappingHelper::PHP_TYPE_INTEGER => [
38
                [1, 1],
39
                ['1', 1],
40
                [' 1', 1],
41
                [' 1 ', 1],
42
            ],
43
            MappingHelper::PHP_TYPE_FLOAT   => [
44
                [1, 1.0],
45
                [1.0, 1.0],
46
                ['1', 1.0],
47
                ['1.1', 1.1],
48
                [' 1.1 ', 1.1],
49
                [' 1.1 ', 1.1],
50
            ],
51
            MappingHelper::PHP_TYPE_BOOLEAN => [
52
                ['true', true],
53
                ['false', false],
54
                ['TRUE', true],
55
                ['FALSE', false],
56
                [' TRue ', true],
57
                [' FaLse ', false],
58
            ],
59
        ];
60
61
        foreach ($defaultValuesToTypes as $type => $valueAndExpecteds) {
62
            foreach ($valueAndExpecteds as $valueAndExpected) {
63
                list($value, $expected) = $valueAndExpected;
64
                $normalised = $this->helper->normaliseValueToType($value, $type);
65
                $this->assertSame($expected, $normalised);
66
            }
67
        }
68
    }
69
}
70