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
Push — master ( 75bdf9...8faa57 )
by joseph
83:56 queued 81:04
created

NamespaceHelperTest::setUpBeforeClass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\Tests\Small\CodeGeneration;
4
5
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\NamespaceHelper;
6
use EdmondsCommerce\DoctrineStaticMeta\Tests\Assets\AbstractTest;
7
use PHPUnit\Framework\TestCase;
8
9
10
/**
11
 * @covers \EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\NamespaceHelper
12
 * @small
13
 */
14
class NamespaceHelperTest extends TestCase
15
{
16
    /**
17
     * @var NamespaceHelper
18
     */
19
    private static $helper;
20
21
    public static function setUpBeforeClass()
22
    {
23
        self::$helper = new NamespaceHelper();
24
    }
25
26
    /**
27
     * @test
28
     * @small
29
     *      */
30
    public function itCanGetTheEntityFqnFromTheEntityInterfaceFqn(): void
31
    {
32
        $expected = AbstractTest::TEST_PROJECT_ROOT_NAMESPACE . '\\Entities\\Foo\\BlahEntity';
33
        $actual   = self::$helper->getEntityFqnFromEntityInterfaceFqn(
34
            AbstractTest::TEST_PROJECT_ROOT_NAMESPACE . '\\Entity\\Interfaces\\Foo\\BlahEntityInterface'
35
        );
36
        self::assertSame($expected, $actual);
37
    }
38
39
    /**
40
     * @test
41
     * @small
42
     *      */
43
    public function itCanGetTheEntityFactoryFqnFromEntityFqn(): void
44
    {
45
        $expected = AbstractTest::TEST_PROJECT_ROOT_NAMESPACE . '\\Entity\\Factories\\Blah\\FooFactory';
46
        $actual   = self::$helper->getFactoryFqnFromEntityFqn(
47
            AbstractTest::TEST_PROJECT_ROOT_NAMESPACE . '\\Entities\\Blah\\Foo'
48
        );
49
        self::assertSame($expected, $actual);
50
    }
51
52
    /**
53
     * @test
54
     * @small
55
     *      */
56
    public function itCanGetTheEntityFqnFromEntityFactoryFqn(): void
57
    {
58
        $factory  = AbstractTest::TEST_PROJECT_ROOT_NAMESPACE . '\\Entity\\Factories\\Blah\\FooFactory';
59
        $expected = AbstractTest::TEST_PROJECT_ROOT_NAMESPACE . '\\Entities\\Blah\\Foo';
60
        $actual   = self::$helper->getEntityFqnFromEntityFactoryFqn($factory);
61
        self::assertSame($expected, $actual);
62
    }
63
64
    /**
65
     * @test
66
     * @large
67
     */
68
    public function getFixtureFqnFromEntityFqn()
69
    {
70
        $expected = AbstractTest::TEST_PROJECT_ROOT_NAMESPACE . '\\Assets\\Entity\\Fixtures\\Blah\\FooFixture';
71
        $actual   = self::$helper->getFixtureFqnFromEntityFqn(
72
            AbstractTest::TEST_PROJECT_ROOT_NAMESPACE . '\\Entities\\Blah\\Foo'
73
        );
74
        self::assertSame($expected, $actual);
75
    }
76
77
    /**
78
     * @test
79
     * @small
80
     *      */
81
    public function cropSuffix(): void
82
    {
83
        $fqn      = 'FooBar';
84
        $suffix   = 'Bar';
85
        $expected = 'Foo';
86
        $actual   = self::$helper->cropSuffix($fqn, $suffix);
87
        self::assertSame($expected, $actual);
88
    }
89
90
    /**
91
     * @test
92
     * @large
93
     *      */
94
    public function swapSuffix(): void
95
    {
96
        $fqn           = 'FooBar';
97
        $currentSuffix = 'Bar';
98
        $newSuffix     = 'Baz';
99
        $expected      = 'FooBaz';
100
        $actual        = self::$helper->swapSuffix($fqn, $currentSuffix, $newSuffix);
101
        self::assertSame($expected, $actual);
102
    }
103
104
    /**
105
     * @test
106
     * @large
107
     *      */
108
    public function cropSuffixWhereSuffixNotInThere(): void
109
    {
110
        $fqn      = 'FooBar';
111
        $suffix   = 'Cheese';
112
        $expected = 'FooBar';
113
        $actual   = self::$helper->cropSuffix($fqn, $suffix);
114
        self::assertSame($expected, $actual);
115
    }
116
117
    /**
118
     * @test
119
     */
120
    public function tidy(): void
121
    {
122
        $namespaceToExpected = [
123
            'Test\\\\Multiple\\\\\\\Separators' => 'Test\\Multiple\\Separators',
124
            'No\\Changes\\Required'             => 'No\\Changes\\Required',
125
        ];
126
        foreach ($namespaceToExpected as $namespace => $expected) {
127
            self::assertSame($expected, self::$helper->tidy($namespace));
128
        }
129
    }
130
131
    /**
132
     * @test
133
     */
134
    public function root(): void
135
    {
136
        $namespaceToExpected = [
137
            '\\Test\\\\Multiple\\\\\\\Separators' => 'Test\\Multiple\\Separators',
138
            'No\\Changes\\Required'               => 'No\\Changes\\Required',
139
        ];
140
        foreach ($namespaceToExpected as $namespace => $expected) {
141
            self::assertSame($expected, self::$helper->root($namespace));
142
        }
143
    }
144
}
145