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 ( 75bdf9...8faa57 )
by joseph
83:56 queued 81:04
created

AbstractEntityFactoryCreatorTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 19
dl 0
loc 64
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A itCanCreateANewAbstractEntityFactory() 0 35 1
A itWontLetYouPassAnewObjectFqn() 0 5 1
A getCreator() 0 11 1
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\Tests\Small\CodeGeneration\Creation\Src\Entity\Factories;
4
5
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Creation\Src\Entity\Factories\AbstractEntityFactoryCreator;
6
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Filesystem\Factory\FileFactory;
7
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Filesystem\Factory\FindReplaceFactory;
8
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Filesystem\File\Writer;
9
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\NamespaceHelper;
10
use EdmondsCommerce\DoctrineStaticMeta\Config;
11
use EdmondsCommerce\DoctrineStaticMeta\Tests\Small\ConfigTest;
12
use PHPUnit\Framework\TestCase;
13
14
/**
15
 * @covers \EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Creation\Src\Entity\Factories\AbstractEntityFactoryCreator
16
 * @covers \EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Creation\AbstractCreator
17
 * @small
18
 */
19
class AbstractEntityFactoryCreatorTest extends TestCase
20
{
21
    /**
22
     * @test
23
     */
24
    public function itWontLetYouPassAnewObjectFqn()
25
    {
26
        $this->expectException(\RuntimeException::class);
27
        $this->expectExceptionMessage('You should not pass a new object FQN to this creator');
28
        $this->getCreator()->createTargetFileObject('\\Some\\Fqn');
29
    }
30
31
    private function getCreator(): AbstractEntityFactoryCreator
32
    {
33
        $namespaceHelper = new NamespaceHelper();
34
        $config          = new Config(ConfigTest::SERVER);
35
36
        return new AbstractEntityFactoryCreator(
37
            new FileFactory($namespaceHelper, $config),
38
            $namespaceHelper,
39
            new Writer(),
40
            $config,
41
            new FindReplaceFactory()
42
        );
43
    }
44
45
    /**
46
     * @test
47
     */
48
    public function itCanCreateANewAbstractEntityFactory(): void
49
    {
50
        $file     = $this->getCreator()
51
                         ->setProjectRootNamespace('My\\Test\\Project')
52
                         ->createTargetFileObject()
53
                         ->getTargetFile();
54
        $expected = '<?php declare(strict_types=1);
55
56
namespace My\Test\Project\Entity\Factories;
57
58
// phpcs:disable -- line length
59
use Doctrine\ORM\EntityManagerInterface;
60
use EdmondsCommerce\DoctrineStaticMeta\Entity as DSM;
61
62
// phpcs:enable
63
64
/**
65
 * @SuppressWarnings(PHPMD.NumberOfChildren)
66
 */
67
class AbstractEntityFactory
68
{
69
    /**
70
     * @var DSM\Factory\EntityFactory
71
     */
72
    protected $entityFactory;
73
74
    public function __construct(DSM\Factory\EntityFactory $entityFactory, EntityManagerInterface $entityManager)
75
    {
76
        $this->entityFactory = $entityFactory;
77
        $this->entityFactory->setEntityManager($entityManager);
78
    }
79
}
80
';
81
        $actual   = $file->getContents();
82
        self::assertSame($expected, $actual);
83
    }
84
}
85