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 ( cc354f...2af0ad )
by joseph
12s
created

RemoveUnusedRelationsCommandTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 23
dl 0
loc 43
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A finderToArrayOfPaths() 0 8 2
A testGenerateRelationsNoFiltering() 0 24 1
A finder() 0 3 1
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Command;
4
5
use EdmondsCommerce\DoctrineStaticMeta\AbstractIntegrationTest;
6
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Generator\RelationsGenerator;
7
use Symfony\Component\Finder\Finder;
8
9
class RemoveUnusedRelationsCommandTest extends AbstractCommandIntegrationTest
10
{
11
    public const WORK_DIR = AbstractIntegrationTest::VAR_PATH.'/'.self::TEST_TYPE.'/RemoveUnusedRelationsCommandTest/';
12
13
    public function testGenerateRelationsNoFiltering(): void
14
    {
15
        $entityFqns = $this->generateEntities();
16
        $this->getRelationsGenerator()->setEntityHasRelationToEntity(
17
            $entityFqns[0],
18
            RelationsGenerator::HAS_ONE_TO_ONE,
19
            $entityFqns[1]
20
        );
21
        $this->setupCopiedWorkDir();
22
        $command = $this->container->get(RemoveUnusedRelationsCommand::class);
23
        $tester  = $this->getCommandTester($command);
24
        $tester->execute(
25
            [
26
                '-'.RemoveUnusedRelationsCommand::OPT_PROJECT_ROOT_PATH_SHORT      => $this->copiedWorkDir,
27
                '-'.RemoveUnusedRelationsCommand::OPT_PROJECT_ROOT_NAMESPACE_SHORT => $this->getCopiedNamespaceRoot(),
28
            ]
29
        );
30
        $expectedFilesFoundCount = 10;
31
        $actualFilesFound        = $this->finderToArrayOfPaths(
32
            $this->finder()->files()->in(
33
                $this->copiedWorkDir.'/src/Entity/Relations/'
34
            )
35
        );
36
        self::assertCount($expectedFilesFoundCount, $actualFilesFound);
37
    }
38
39
    private function finder(): Finder
40
    {
41
        return new Finder();
42
    }
43
44
    private function finderToArrayOfPaths(Finder $finder): array
45
    {
46
        $return = [];
47
        foreach ($finder as $fileInfo) {
48
            $return[] = $fileInfo->getRealPath();
49
        }
50
51
        return $return;
52
    }
53
}
54