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

itCanCreateANewDeeplyNestedEntityInterfaceFromEntityFqn()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 0
dl 0
loc 10
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\Tests\Small\CodeGeneration\Creation\Src\Entity\Interfaces;
4
5
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Creation\Src\Entity\Interfaces\EntityFactoryCreator;
0 ignored issues
show
Bug introduced by
The type EdmondsCommerce\Doctrine...es\EntityFactoryCreator was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Creation\Src\Entity\Interfaces\EntityInterfaceCreator;
7
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Filesystem\Factory\FileFactory;
8
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Filesystem\Factory\FindReplaceFactory;
9
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Filesystem\File\Writer;
10
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\NamespaceHelper;
11
use EdmondsCommerce\DoctrineStaticMeta\Config;
12
use EdmondsCommerce\DoctrineStaticMeta\Tests\Small\ConfigTest;
13
use PHPUnit\Framework\TestCase;
14
15
/**
16
 * @covers \EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Creation\Src\Entity\Interfaces\EntityInterfaceCreator
17
 * @covers \EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Creation\AbstractCreator
18
 * @small
19
 */
20
class EntityInterfaceCreatorTest extends TestCase
21
{
22
    private const INTERFACE = '<?php declare(strict_types=1);
23
24
namespace EdmondsCommerce\DoctrineStaticMeta\Entity\Interfaces;
25
26
use EdmondsCommerce\DoctrineStaticMeta\Entity as DSM;
27
28
interface TestEntityInterface extends DSM\Interfaces\EntityInterface
29
{
30
31
}
32
';
33
34
    private const NESTED_INTERFACE = '<?php declare(strict_types=1);
35
36
namespace EdmondsCommerce\DoctrineStaticMeta\Entity\Interfaces\Super\Deeply\Nested;
37
38
use EdmondsCommerce\DoctrineStaticMeta\Entity as DSM;
39
40
interface TestEntityInterface extends DSM\Interfaces\EntityInterface
41
{
42
43
}
44
';
45
46
    /**
47
     * @test
48
     */
49
    public function itCanCreateANewEntityInterface(): void
50
    {
51
        $newObjectFqn = 'EdmondsCommerce\\DoctrineStaticMeta\\Entity\\Interfaces\\TestEntityInterface';
52
        $file         = $this->getCreator()->createTargetFileObject($newObjectFqn)->getTargetFile();
53
        $expected     = self::INTERFACE;
54
        $actual       = $file->getContents();
55
        self::assertSame($expected, $actual);
56
    }
57
58
    private function getCreator(): EntityInterfaceCreator
59
    {
60
        $namespaceHelper = new NamespaceHelper();
61
        $config          = new Config(ConfigTest::SERVER);
62
63
        return new EntityInterfaceCreator(
64
            new FileFactory($namespaceHelper, $config),
65
            $namespaceHelper,
66
            new Writer(),
67
            $config,
68
            new FindReplaceFactory()
69
        );
70
    }
71
72
    /**
73
     * @test
74
     */
75
    public function itCanCreateANewEntityInterfaceFromEntityFqn(): void
76
    {
77
        $entityFqn = 'EdmondsCommerce\\DoctrineStaticMeta\\Entities\\TestEntity';
78
        $file      = $this->getCreator()
79
                          ->setNewObjectFqnFromEntityFqn($entityFqn)
80
                          ->createTargetFileObject()
81
                          ->getTargetFile();
82
        $expected  = self::INTERFACE;
83
        $actual    = $file->getContents();
84
        self::assertSame($expected, $actual);
85
    }
86
87
    /**
88
     * @test
89
     */
90
    public function itCanCreateANewDeeplyNestedEntityInterface(): void
91
    {
92
        $newObjectFqn =
93
            'EdmondsCommerce\\DoctrineStaticMeta\\Entity\\Interfaces\\Super\\Deeply\\Nested\\TestEntityInterface';
94
        $file         = $this->getCreator()->createTargetFileObject($newObjectFqn)->getTargetFile();
95
        $expected     = self::NESTED_INTERFACE;
96
        $actual       = $file->getContents();
97
        self::assertSame($expected, $actual);
98
    }
99
100
    /**
101
     * @test
102
     */
103
    public function itCanCreateANewDeeplyNestedEntityInterfaceFromEntityFqn(): void
104
    {
105
        $entityFqn = 'EdmondsCommerce\\DoctrineStaticMeta\\Entities\\Super\\Deeply\\Nested\\TestEntity';
106
        $file      = $this->getCreator()
107
                          ->setNewObjectFqnFromEntityFqn($entityFqn)
108
                          ->createTargetFileObject()
109
                          ->getTargetFile();
110
        $expected  = self::NESTED_INTERFACE;
111
        $actual    = $file->getContents();
112
        self::assertSame($expected, $actual);
113
    }
114
}
115