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
22:07
created

theEntityCanBeSavedAndLoadedWithCorrectValues()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 14
nc 1
nop 0
dl 0
loc 21
rs 9.7998
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
        $this->getEntitySaver()->save($entity);
72
73
        $loaded = $this->getRepositoryFactory()
74
                       ->getRepository($this->entityFqn)
75
                       ->findAll()[0];
76
        self::assertSame($entity, $loaded);
77
    }
78
79
    /**
80
     * @test
81
     * @large
82
     * @covers \EdmondsCommerce\DoctrineStaticMeta\Entity\Embeddable\Traits\Geo\HasAddressEmbeddableTrait
83
     * @SuppressWarnings(PHPMD.StaticAccess)
84
     */
85
    public function theEntityCanBeSavedAndLoadedWithCorrectValuesWithAnArray(): void
86
    {
87
        /**
88
         * @var HasAddressEmbeddableInterface $entity
89
         */
90
        $entity = $this->createEntity($this->entityFqn);
91
        $entity->update(
92
            new class($this->entityFqn, $entity->getId()) extends AbstractEntityUpdateDto
93
            {
94
                public function getAddressEmbeddable()
95
                {
96
                    return AddressEmbeddable::create(
97
                        [
98
                            '1',
99
                            '',
100
                            'streetname',
101
                            'cityname',
102
                            'ABC 123',
103
                            'county',
104
                            'UK',
105
                        ]
106
                    );
107
                }
108
109
            }
110
        );
111
112
        $this->getEntitySaver()->save($entity);
113
114
        $loaded = $this->getRepositoryFactory()
115
                       ->getRepository($this->entityFqn)
116
                       ->findAll()[0];
117
        self::assertSame($entity, $loaded);
118
    }
119
}
120