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.
Passed
Pull Request — master (#153)
by joseph
05:51
created

HasAddressEmbeddableTraitLargeTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 103
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 48
dl 0
loc 103
rs 10
c 0
b 0
f 0
wmc 2

7 Methods

Rating   Name   Duplication   Size   Complexity  
A hp$0 ➔ getAddressEmbeddable() 0 11 1
A hp$0 ➔ theEntityCanBeSavedAndLoadedWithCorrectValuesWithAnAssocArray() 0 34 1
theEntityCanBeSavedAndLoadedWithCorrectValuesWithAnAssocArray() 0 34 ?
theEntityCanBeSavedAndLoadedWithCorrectValuesWithAnArray() 0 34 ?
A setup() 0 11 2
A hp$1 ➔ theEntityCanBeSavedAndLoadedWithCorrectValuesWithAnArray() 0 34 1
A hp$1 ➔ getAddressEmbeddable() 0 11 1
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
     * @covers \EdmondsCommerce\DoctrineStaticMeta\Entity\Embeddable\Traits\Geo\HasAddressEmbeddableTrait
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
     */
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
113
        $this->getEntitySaver()->save($entity);
114
115
        $loaded = $this->getRepositoryFactory()
116
                       ->getRepository($this->entityFqn)
117
                       ->findAll()[0];
118
        self::assertSame($entity, $loaded);
119
    }
120
}
121