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 ( 349a12...725c6d )
by joseph
15:11 queued 12:41
created

removeUnusedRelations()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 24
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 24
rs 9.7333
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\Tests\Large\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
 * @coversDefaultClass \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
     * @covers ::execute
27
     * @throws \EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException
28
     * @throws \ReflectionException
29
     */
30
    public function removeUnusedRelations(): void
31
    {
32
        $entityFqns = $this->generateEntities();
33
        $this->getRelationsGenerator()->setEntityHasRelationToEntity(
34
            $entityFqns[0],
35
            RelationsGenerator::HAS_ONE_TO_ONE,
36
            $entityFqns[1]
37
        );
38
        $this->setupCopiedWorkDir();
39
        $command = $this->container->get(RemoveUnusedRelationsCommand::class);
40
        $tester  = $this->getCommandTester($command);
41
        $tester->execute(
42
            [
43
                '-' . RemoveUnusedRelationsCommand::OPT_PROJECT_ROOT_PATH_SHORT      => $this->copiedWorkDir,
44
                '-' . RemoveUnusedRelationsCommand::OPT_PROJECT_ROOT_NAMESPACE_SHORT => $this->getCopiedNamespaceRoot(),
45
            ]
46
        );
47
        $expectedFilesFoundCount = 10;
48
        $actualFilesFound        = $this->finderToArrayOfPaths(
49
            $this->finder()->files()->in(
50
                $this->copiedWorkDir . '/src/Entity/Relations/'
51
            )
52
        );
53
        self::assertCount($expectedFilesFoundCount, $actualFilesFound);
54
    }
55
56
    private function finderToArrayOfPaths(Finder $finder): array
57
    {
58
        $return = [];
59
        foreach ($finder as $fileInfo) {
60
            $return[] = $fileInfo->getRealPath();
61
        }
62
63
        return $return;
64
    }
65
66
    private function finder(): Finder
67
    {
68
        return new Finder();
69
    }
70
}
71