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 ( a48bd8...83d092 )
by joseph
16:18 queued 18s
created

setup()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 7
nc 2
nop 0
dl 0
loc 10
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\Tests\Large\E\CodeGeneration\Action;
4
5
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Action\CreateDtosForAllEntitiesAction;
6
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\CodeHelper;
7
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Creation\Src\Entity\DataTransferObjects\DtoCreator;
8
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Filesystem\Factory\FileFactory;
9
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Filesystem\Factory\FindReplaceFactory;
10
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Filesystem\File\Writer;
11
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\NamespaceHelper;
12
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\ReflectionHelper;
13
use EdmondsCommerce\DoctrineStaticMeta\Config;
14
use EdmondsCommerce\DoctrineStaticMeta\Tests\Assets\AbstractTest;
15
use EdmondsCommerce\DoctrineStaticMeta\Tests\Small\ConfigTest;
16
17
/**
18
 * @covers \EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Action\CreateDtosForAllEntitiesAction
19
 * @large
20
 */
21
class CreateDataTransferObjectsForAllEntitiesActionTest extends AbstractTest
22
{
23
    public const WORK_DIR = self::VAR_PATH . '/' . self::TEST_TYPE_LARGE .
24
                            '/CreateDataTransferObjectsForAllEntitiesActionTest';
25
26
    protected static $buildOnce = true;
27
28
    public function setup()
29
    {
30
        parent::setUp();
31
        if (false === self::$built) {
32
            $this->getTestCodeGenerator()
33
                 ->copyTo(self::WORK_DIR);
34
            $this->getFileSystem()->remove(self::WORK_DIR . '/src/Entity/DataTransferObjects');
35
            self::$built = true;
36
        }
37
        $this->setupCopiedWorkDir();
38
    }
39
40
    /**
41
     * @test
42
     */
43
    public function itCanCreateDtosForAllEntities(): void
44
    {
45
        $this->getAction()->run();
46
        self::assertFileExists($this->copiedWorkDir . '/src/Entity/DataTransferObjects/PersonDto.php');
47
        $this->qaGeneratedCode();
48
    }
49
50
    private function getAction(): CreateDtosForAllEntitiesAction
51
    {
52
        $namespaceHelper = new NamespaceHelper();
53
        $config          = new Config(ConfigTest::SERVER);
54
55
        $creator = new DtoCreator(
56
            new FileFactory($namespaceHelper, $config),
57
            $namespaceHelper,
58
            new Writer(),
59
            $config,
60
            new FindReplaceFactory(),
61
            new ReflectionHelper($namespaceHelper),
62
            new CodeHelper($namespaceHelper)
63
        );
64
65
        $action = new CreateDtosForAllEntitiesAction($creator, $namespaceHelper);
66
        $action->setProjectRootNamespace($this->copiedRootNamespace);
0 ignored issues
show
Bug introduced by
It seems like $this->copiedRootNamespace can also be of type null; however, parameter $projectRootNamespace of EdmondsCommerce\Doctrine...tProjectRootNamespace() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

66
        $action->setProjectRootNamespace(/** @scrutinizer ignore-type */ $this->copiedRootNamespace);
Loading history...
67
        $action->setProjectRootDirectory($this->copiedWorkDir);
0 ignored issues
show
Bug introduced by
It seems like $this->copiedWorkDir can also be of type null; however, parameter $projectRootDirectory of EdmondsCommerce\Doctrine...tProjectRootDirectory() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

67
        $action->setProjectRootDirectory(/** @scrutinizer ignore-type */ $this->copiedWorkDir);
Loading history...
68
69
        return $action;
70
    }
71
72
    /**
73
     * @test
74
     */
75
    public function itCanBeRunMultipleTimes(): void
76
    {
77
        $this->getAction()->run();
78
        $this->getAction()->run();
79
        self::assertFileExists($this->copiedWorkDir . '/src/Entity/DataTransferObjects/PersonDto.php');
80
    }
81
}
82