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
Pull Request — master (#75)
by joseph
14:44
created

EntityFactoryTest::itCanCreateAnEmptyEntity()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\Entity\Factory;
4
5
use EdmondsCommerce\DoctrineStaticMeta\AbstractIntegrationTest;
6
use EdmondsCommerce\DoctrineStaticMeta\Entity\Fields\Interfaces\String\EmailAddressFieldInterface;
7
use EdmondsCommerce\DoctrineStaticMeta\Entity\Fields\Interfaces\String\IsbnFieldInterface;
8
use EdmondsCommerce\DoctrineStaticMeta\Entity\Fields\Traits\String\EmailAddressFieldTrait;
9
use EdmondsCommerce\DoctrineStaticMeta\Entity\Fields\Traits\String\IsbnFieldTrait;
10
11
class EntityFactoryTest extends AbstractIntegrationTest
12
{
13
    public const WORK_DIR = AbstractIntegrationTest::VAR_PATH.'/'.self::TEST_TYPE.'/EntityFactoryTest';
14
15
    private const TEST_ENTITY_FQN = self::TEST_PROJECT_ROOT_NAMESPACE.'\\Entities\\TestEntity';
16
17
    private $entityFqn;
18
19
    /**
20
     * @var EntityFactory
21
     */
22
    private $factory;
23
24
    private $built = false;
25
26
    public function setup()
27
    {
28
        parent::setup();
29
        if (false === $this->built) {
30
            $this->getEntityGenerator()->generateEntity(self::TEST_ENTITY_FQN);
31
            $this->getFieldSetter()->setEntityHasField(
32
                self::TEST_ENTITY_FQN,
33
                IsbnFieldTrait::class
34
            );
35
            $this->getFieldSetter()->setEntityHasField(
36
                self::TEST_ENTITY_FQN,
37
                EmailAddressFieldTrait::class
38
            );
39
            $this->built = true;
40
        }
41
        $this->setupCopiedWorkDir();
42
        $this->entityFqn = $this->getCopiedFqn(self::TEST_ENTITY_FQN);
43
        $this->factory   = $this->container->get(EntityFactory::class);
44
    }
45
46
    /**
47
     * @test
48
     *
49
     */
50
    public function itCanCreateAnEmptyEntity(): void
51
    {
52
        $entity = $this->factory->create($this->entityFqn);
53
        self::assertInstanceOf($this->entityFqn, $entity);
54
    }
55
56
    /**
57
     * @test
58
     *
59
     */
60
    public function itThrowsAnExceptionIfThereIsAnInvalidProperty(): void
61
    {
62
        $this->expectException(\InvalidArgumentException::class);
63
        $this->factory->create($this->entityFqn, ['invalidProperty' => true]);
64
    }
65
66
    /**
67
     * @test
68
     *
69
     */
70
    public function itCanCreateAnEntityWithValues(): void
71
    {
72
        $values = [
73
            IsbnFieldInterface::PROP_ISBN                  => '978-3-16-148410-0',
74
            EmailAddressFieldInterface::PROP_EMAIL_ADDRESS => '[email protected]',
75
        ];
76
        $entity = $this->factory->create($this->entityFqn, $values);
77
78
        self::assertSame($entity->getIsbn(), $values[IsbnFieldInterface::PROP_ISBN]);
0 ignored issues
show
Bug introduced by
The method getIsbn() does not exist on EdmondsCommerce\Doctrine...erfaces\EntityInterface. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

78
        self::assertSame($entity->/** @scrutinizer ignore-call */ getIsbn(), $values[IsbnFieldInterface::PROP_ISBN]);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
79
80
        self::assertSame($entity->getEmailAddress(), $values[EmailAddressFieldInterface::PROP_EMAIL_ADDRESS]);
0 ignored issues
show
Bug introduced by
The method getEmailAddress() does not exist on EdmondsCommerce\Doctrine...erfaces\EntityInterface. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

80
        self::assertSame($entity->/** @scrutinizer ignore-call */ getEmailAddress(), $values[EmailAddressFieldInterface::PROP_EMAIL_ADDRESS]);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
81
    }
82
}
83