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

RemoveUnusedRelationsCommandTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 25
dl 0
loc 51
rs 10
c 0
b 0
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A finderToArrayOfPaths() 0 8 2
A finder() 0 3 1
A removeUnusedRelations() 0 23 1
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\Tests\Large\E\CodeGeneration\Command;
4
5
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Command\RemoveUnusedRelationsCommand;
6
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Generator\RelationsGenerator;
7
use EdmondsCommerce\DoctrineStaticMeta\Tests\Assets\AbstractTest;
8
use Symfony\Component\Finder\Finder;
9
10
/**
11
 * Class RemoveUnusedRelationsCommandTest
12
 *
13
 * @package EdmondsCommerce\DoctrineStaticMeta\Tests\Large\CodeGeneration\Command
14
 * @covers \EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Command\RemoveUnusedRelationsCommand
15
 */
16
class RemoveUnusedRelationsCommandTest extends AbstractCommandTest
17
{
18
    public const WORK_DIR = AbstractTest::VAR_PATH .
19
                            '/' .
20
                            self::TEST_TYPE_LARGE .
21
                            '/RemoveUnusedRelationsCommandTest/';
22
23
    /**
24
     * @test
25
     * @large
26
     *      * @throws \EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException
27
     * @throws \ReflectionException
28
     */
29
    public function removeUnusedRelations(): void
30
    {
31
        $entityFqns = $this->getTestEntityFqns();
32
        $this->getRelationsGenerator()->setEntityHasRelationToEntity(
33
            $entityFqns[0],
34
            RelationsGenerator::HAS_ONE_TO_ONE,
35
            $entityFqns[1]
36
        );
37
        $command = $this->container->get(RemoveUnusedRelationsCommand::class);
38
        $tester  = $this->getCommandTester($command);
39
        $tester->execute(
40
            [
41
                '-' . RemoveUnusedRelationsCommand::OPT_PROJECT_ROOT_PATH_SHORT      => $this->copiedWorkDir,
42
                '-' . RemoveUnusedRelationsCommand::OPT_PROJECT_ROOT_NAMESPACE_SHORT => $this->copiedRootNamespace,
43
            ]
44
        );
45
        $expectedFilesFoundCount = 162;
46
        $actualFilesFound        = $this->finderToArrayOfPaths(
47
            $this->finder()->files()->in(
48
                $this->copiedWorkDir . '/src/Entity/Relations/'
49
            )
50
        );
51
        self::assertCount($expectedFilesFoundCount, $actualFilesFound);
52
    }
53
54
    private function finderToArrayOfPaths(Finder $finder): array
55
    {
56
        $return = [];
57
        foreach ($finder as $fileInfo) {
58
            $return[] = $fileInfo->getRealPath();
59
        }
60
61
        return $return;
62
    }
63
64
    private function finder(): Finder
65
    {
66
        return new Finder();
67
    }
68
}
69