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 (#57)
by joseph
16:59
created

NamespaceHelperTest::testGetObjectShortName()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 7
nc 2
nop 0
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\CodeGeneration;
4
5
use PHPUnit\Framework\TestCase;
6
7
class NamespaceHelperTest extends TestCase
8
{
9
    /**
10
     * @var NamespaceHelper
11
     */
12
    private static $helper;
13
14
    public static function setupBeforeClass()
15
    {
16
        self::$helper = new NamespaceHelper();
17
    }
18
19
    public function testCropSuffix()
20
    {
21
        $fqn      = 'FooBar';
22
        $suffix   = 'Bar';
23
        $expected = 'Foo';
24
        $actual   = self::$helper->cropSuffix($fqn, $suffix);
25
        $this->assertSame($expected, $actual);
26
    }
27
28
    public function testCropSuffixWhereSuffixNotInThere()
29
    {
30
        $fqn      = 'FooBar';
31
        $suffix   = 'Cheese';
32
        $expected = 'FooBar';
33
        $actual   = self::$helper->cropSuffix($fqn, $suffix);
34
        $this->assertSame($expected, $actual);
35
    }
36
37
    public function testGetObjectShortName()
38
    {
39
40
        $expectedToObjects = [
41
            'NamespaceHelperTest' => $this,
42
            'NamespaceHelper'     => self::$helper,
43
        ];
44
        $actual            = [];
45
        foreach ($expectedToObjects as $object) {
46
            $actual[self::$helper->getObjectShortName($object)] = $object;
47
        }
48
        $this->assertSame($expectedToObjects, $actual);
49
    }
50
51
    public function testGetObjectFqn()
52
    {
53
54
        $expectedToObjects = [
55
            \get_class($this)         => $this,
56
            \get_class(self::$helper) => self::$helper,
57
        ];
58
        $actual            = [];
59
        foreach ($expectedToObjects as $object) {
60
            $actual[self::$helper->getObjectFqn($object)] = $object;
61
        }
62
        $this->assertSame($expectedToObjects, $actual);
63
    }
64
65
    public function testGetClassShortName()
66
    {
67
        $expectedToFqns = [
68
            'NamespaceHelperTest' => \get_class($this),
69
            'Cheese'              => '\\Super\\Cheese',
70
        ];
71
        $actual         = [];
72
        foreach ($expectedToFqns as $fqn) {
73
            $actual[self::$helper->getClassShortName($fqn)] = $fqn;
74
        }
75
        $this->assertSame($expectedToFqns, $actual);
76
    }
77
}
78