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 (#153)
by joseph
16:42
created

HasAddressEmbeddableTraitLargeTest::setup()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 8
nc 2
nop 0
dl 0
loc 11
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\Tests\Large\C\Entity\Embeddable\Traits\Geo;
4
5
use EdmondsCommerce\DoctrineStaticMeta\Entity\DataTransferObjects\AbstractEntityUpdateDto;
6
use EdmondsCommerce\DoctrineStaticMeta\Entity\Embeddable\Interfaces\Geo\HasAddressEmbeddableInterface;
7
use EdmondsCommerce\DoctrineStaticMeta\Entity\Embeddable\Interfaces\Objects\Geo\AddressEmbeddableInterface;
8
use EdmondsCommerce\DoctrineStaticMeta\Entity\Embeddable\Objects\Geo\AddressEmbeddable;
9
use EdmondsCommerce\DoctrineStaticMeta\Entity\Embeddable\Traits\Geo\HasAddressEmbeddableTrait;
10
use EdmondsCommerce\DoctrineStaticMeta\Tests\Assets\AbstractLargeTest;
11
12
/**
13
 * @large
14
 * @covers \EdmondsCommerce\DoctrineStaticMeta\Entity\Embeddable\Traits\Geo\HasAddressEmbeddableTrait
15
 */
16
class HasAddressEmbeddableTraitLargeTest extends AbstractLargeTest
17
{
18
    public const  WORK_DIR    = self::VAR_PATH .
19
                                '/' .
20
                                self::TEST_TYPE_LARGE .
21
                                '/HasAddressEmbeddableTraitLargeTest';
22
    private const TEST_ENTITY = self::TEST_PROJECT_ROOT_NAMESPACE . '\\Entities\\Place';
23
    protected static $buildOnce = true;
24
    private          $entityFqn;
25
26
    public function setup()
27
    {
28
        parent::setUp();
29
        if (false === self::$built) {
30
            $this->getEntityGenerator()->generateEntity(self::TEST_ENTITY);
31
            $this->getEntityEmbeddableSetter()
32
                 ->setEntityHasEmbeddable(self::TEST_ENTITY, HasAddressEmbeddableTrait::class);
33
        }
34
        $this->setupCopiedWorkDirAndCreateDatabase();
35
        $this->recreateDtos();
36
        $this->entityFqn = $this->getCopiedFqn(self::TEST_ENTITY);
37
    }
38
39
    /**
40
     * @test
41
     * @large
42
     * @SuppressWarnings(PHPMD.StaticAccess)
43
     */
44
    public function theEntityCanBeSavedAndLoadedWithCorrectValuesWithAnAssocArray(): void
45
    {
46
        /**
47
         * @var HasAddressEmbeddableInterface $entity
48
         */
49
        $entity = $this->createEntity($this->entityFqn);
50
        $entity->update(
51
            new class($this->entityFqn, $entity->getId()) extends AbstractEntityUpdateDto
52
            {
53
                public function getAddressEmbeddable()
54
                {
55
                    return AddressEmbeddable::create(
56
                        [
57
                            AddressEmbeddableInterface::EMBEDDED_PROP_HOUSE_NUMBER => '1',
58
                            AddressEmbeddableInterface::EMBEDDED_PROP_HOUSE_NAME   => '',
59
                            AddressEmbeddableInterface::EMBEDDED_PROP_STREET       => 'streetname',
60
                            AddressEmbeddableInterface::EMBEDDED_PROP_CITY         => 'cityname',
61
                            AddressEmbeddableInterface::EMBEDDED_PROP_POSTAL_CODE  => 'ABC 123',
62
                            AddressEmbeddableInterface::EMBEDDED_PROP_POSTAL_AREA  => 'county',
63
                            AddressEmbeddableInterface::EMBEDDED_PROP_COUNTRY_CODE => 'UK',
64
                        ]
65
66
                    );
67
                }
68
69
            }
70
        );
71
72
        $this->getEntitySaver()->save($entity);
73
74
        $loaded = $this->getRepositoryFactory()
75
                       ->getRepository($this->entityFqn)
76
                       ->findAll()[0];
77
        self::assertSame($entity, $loaded);
78
    }
79
80
    /**
81
     * @test
82
     * @large
83
     * @covers \EdmondsCommerce\DoctrineStaticMeta\Entity\Embeddable\Traits\Geo\HasAddressEmbeddableTrait
84
     * @SuppressWarnings(PHPMD.StaticAccess)
85
     */
86
    public function theEntityCanBeSavedAndLoadedWithCorrectValuesWithAnArray(): void
87
    {
88
        /**
89
         * @var HasAddressEmbeddableInterface $entity
90
         */
91
        $entity = $this->createEntity($this->entityFqn);
92
        $entity->update(
93
            new class($this->entityFqn, $entity->getId()) extends AbstractEntityUpdateDto
94
            {
95
                public function getAddressEmbeddable()
96
                {
97
                    return AddressEmbeddable::create(
98
                        [
99
                            '1',
100
                            '',
101
                            'streetname',
102
                            'cityname',
103
                            'ABC 123',
104
                            'county',
105
                            'UK',
106
                        ]
107
108
                    );
109
                }
110
111
            }
112
        );
113
114
        $this->getEntitySaver()->save($entity);
115
116
        $loaded = $this->getRepositoryFactory()
117
                       ->getRepository($this->entityFqn)
118
                       ->findAll()[0];
119
        self::assertSame($entity, $loaded);
120
    }
121
}
122