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

HasWeightEmbeddableTraitLargeTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 20
dl 0
loc 48
rs 10
c 0
b 0
f 0
wmc 3

6 Methods

Rating   Name   Duplication   Size   Complexity  
A hp$0 ➔ getWeightEmbeddable() 0 5 1
itCanBeSavedAndReloadedWithTheCorrectValues() 0 20 ?
A hp$0 ➔ itCanBeSavedAndReloadedWithTheCorrectValues() 0 20 1
A hp$0 ➔ createTestEntity() 0 3 1
createTestEntity() 0 3 ?
A setUp() 0 6 1
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\Tests\Large\C\Entity\Embeddable\Traits\Attribute;
4
5
use EdmondsCommerce\DoctrineStaticMeta\Entity\DataTransferObjects\AbstractEntityUpdateDto;
6
use EdmondsCommerce\DoctrineStaticMeta\Entity\Embeddable\Interfaces\Attribute\HasWeightEmbeddableInterface;
7
use EdmondsCommerce\DoctrineStaticMeta\Entity\Embeddable\Interfaces\Objects\Attribute\WeightEmbeddableInterface;
8
use EdmondsCommerce\DoctrineStaticMeta\Entity\Embeddable\Objects\Attribute\WeightEmbeddable;
9
use EdmondsCommerce\DoctrineStaticMeta\Entity\Interfaces\EntityInterface;
10
use EdmondsCommerce\DoctrineStaticMeta\Tests\Assets\AbstractLargeTest;
11
use EdmondsCommerce\DoctrineStaticMeta\Tests\Assets\TestCodeGenerator;
12
13
/**
14
 * @large
15
 * @covers \EdmondsCommerce\DoctrineStaticMeta\Entity\Embeddable\Traits\Attribute\HasWeightEmbeddableTrait
16
 */
17
class HasWeightEmbeddableTraitLargeTest extends AbstractLargeTest
18
{
19
    public const  WORK_DIR    = self::VAR_PATH . '/' . self::TEST_TYPE_LARGE . '/HasWeightEmbeddableTraitLargeTest';
20
    private const TEST_ENTITY = self::TEST_ENTITIES_ROOT_NAMESPACE . TestCodeGenerator::TEST_ENTITY_ALL_EMBEDDABLES;
21
22
    public function setUp()
23
    {
24
        parent::setUp();
25
        $this->generateTestCode();
26
        $this->setupCopiedWorkDirAndCreateDatabase();
27
        $this->entityFqn = $this->getCopiedFqn(self::TEST_ENTITY);
28
    }
29
30
    /**
31
     * @test
32
     * @throws \EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException
33
     * @throws \ReflectionException
34
     */
35
    public function itCanBeSavedAndReloadedWithTheCorrectValues()
36
    {
37
        $entity = $this->createTestEntity();
38
        $entity->update(new class($this->getCopiedFqn(self::TEST_ENTITY), $entity->getId())
0 ignored issues
show
Bug introduced by
The method update() does not exist on EdmondsCommerce\Doctrine...ightEmbeddableInterface. ( Ignorable by Annotation )

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

38
        $entity->/** @scrutinizer ignore-call */ 
39
                 update(new class($this->getCopiedFqn(self::TEST_ENTITY), $entity->getId())

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...
Bug introduced by
The method getId() does not exist on EdmondsCommerce\Doctrine...ightEmbeddableInterface. ( Ignorable by Annotation )

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

38
        $entity->update(new class($this->getCopiedFqn(self::TEST_ENTITY), $entity->/** @scrutinizer ignore-call */ getId())

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...
39
            extends AbstractEntityUpdateDto
40
        {
41
            public function getWeightEmbeddable(): WeightEmbeddableInterface
42
            {
43
                return new WeightEmbeddable(
44
                    WeightEmbeddableInterface::UNIT_GRAM,
45
                    100
46
                );
47
            }
48
        });
49
        $this->getEntitySaver()->save($entity);
50
        $loaded                 =
51
            $this->getRepositoryFactory()->getRepository($this->getCopiedFqn(self::TEST_ENTITY))->findAll()[0];
52
        $loadedWeightEmbeddable = $loaded->getWeightEmbeddable();
53
        self::assertSame(WeightEmbeddableInterface::UNIT_GRAM, $loadedWeightEmbeddable->getUnit());
54
        self::assertSame(100.0, $loadedWeightEmbeddable->getValue());
55
    }
56
57
    /**
58
     * @return HasWeightEmbeddableInterface|EntityInterface
59
     * @throws \EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException
60
     * @throws \ReflectionException
61
     */
62
    private function createTestEntity(): HasWeightEmbeddableInterface
63
    {
64
        return $this->createEntity($this->getCopiedFqn(self::TEST_ENTITY));
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->createEnti...Fqn(self::TEST_ENTITY)) returns the type EdmondsCommerce\Doctrine...erfaces\EntityInterface which is incompatible with the type-hinted return EdmondsCommerce\Doctrine...ightEmbeddableInterface.
Loading history...
65
    }
66
67
}