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 ( 647edc...edf045 )
by joseph
18s queued 16s
created

AbstractCommandIntegrationTest::generateEntities()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 17
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 12
nc 2
nop 0
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Command;
4
5
use Doctrine\ORM\EntityManager;
6
use Doctrine\ORM\Tools\Console\ConsoleRunner;
7
use EdmondsCommerce\DoctrineStaticMeta\AbstractIntegrationTest;
8
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Generator\AbstractGenerator;
9
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Generator\EntityGenerator;
10
use Symfony\Component\Console\Application;
11
use Symfony\Component\Console\Tester\CommandTester;
12
13
abstract class AbstractCommandIntegrationTest extends AbstractIntegrationTest
14
{
15
16
    /**
17
     * @param AbstractCommand $command
18
     *
19
     * @return CommandTester
20
     * @throws \EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException
21
     * @SuppressWarnings(PHPMD.StaticAccess)
22
     */
23
    protected function getCommandTester(AbstractCommand $command): CommandTester
24
    {
25
        $application = new Application();
26
        //$_SERVER[ConfigInterface::PARAM_ENTITIES_PATH] = static::WORK_DIR.'/src/Entities';
27
        $helperSet = ConsoleRunner::createHelperSet(
28
            $this->container->get(EntityManager::class)
29
        );
30
        $application->setHelperSet($helperSet);
31
        $application->add($command);
32
33
        return new CommandTester($command);
34
    }
35
36
    protected function getEntityPath(string $entityFqn)
37
    {
38
        $entityPath = str_replace(
39
            '\\',
40
            '/',
41
            \substr(
42
                $entityFqn,
43
                \strpos(
44
                    $entityFqn,
45
                    'Entities\\'
46
                ) + \strlen('Entities\\')
47
            )
48
        );
49
50
        return '/'.$entityPath;
51
    }
52
53
    /**
54
     * @return array
55
     * @throws \EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException
56
     */
57
    protected function generateEntities(): array
58
    {
59
        $entityGenerator = $this->container->get(EntityGenerator::class);
60
        $entityGenerator->setProjectRootNamespace(static::TEST_PROJECT_ROOT_NAMESPACE)
61
                        ->setPathToProjectRoot(static::WORK_DIR);
62
        $baseNamespace = self::TEST_PROJECT_ROOT_NAMESPACE.'\\'
63
                         .AbstractGenerator::ENTITIES_FOLDER_NAME.'\\'.$this->getName();
64
        $entityFqns    = [
65
            $baseNamespace.'\\FirstEntity',
66
            $baseNamespace.'\\Second\\SecondEntity',
67
            $baseNamespace.'\\Now\\Third\\ThirdEntity',
68
        ];
69
        foreach ($entityFqns as $fullyQualifiedName) {
70
            $entityGenerator->generateEntity($fullyQualifiedName);
71
        }
72
73
        return $entityFqns;
74
    }
75
}
76