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 (#197)
by joseph
26:30
created

EntityDebugDumperTest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 38
dl 0
loc 77
rs 10
c 0
b 0
f 0
wmc 6

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setUpBeforeClass() 0 4 1
A setup() 0 9 2
A getEntity() 0 23 1
A itConvertsCollectionsToAListOfIDs() 0 7 1
A itRemovesTrailingZerosOnDecimals() 0 6 1
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\Tests\Medium\Entity\Testing;
4
5
use EdmondsCommerce\DoctrineStaticMeta\AbstractIntegrationTest;
0 ignored issues
show
Bug introduced by
The type EdmondsCommerce\Doctrine...AbstractIntegrationTest was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use EdmondsCommerce\DoctrineStaticMeta\Entity\Interfaces\EntityInterface;
7
use EdmondsCommerce\DoctrineStaticMeta\Entity\Testing\EntityDebugDumper;
8
use EdmondsCommerce\DoctrineStaticMeta\Tests\Assets\AbstractTest;
9
use EdmondsCommerce\DoctrineStaticMeta\Tests\Assets\TestCodeGenerator;
10
11
/**
12
 * Class EntityDebugDumperTest
13
 *
14
 * @package EdmondsCommerce\DoctrineStaticMeta\Entity\Testing
15
 * @covers  \EdmondsCommerce\DoctrineStaticMeta\Entity\Testing\EntityDebugDumper
16
 * @medium
17
 */
18
class EntityDebugDumperTest extends AbstractTest
19
{
20
    public const WORK_DIR = AbstractTest::VAR_PATH . '/' . self::TEST_TYPE_MEDIUM . '/EntityDebugDumperTest';
21
22
    private const TEST_ENTITY_FQN = self::TEST_ENTITIES_ROOT_NAMESPACE . TestCodeGenerator::TEST_ENTITY_PERSON;
23
24
    private const VALUE_DECIMAL = '20.10000000000000';
25
    protected static $buildOnce = true;
26
    /**
27
     * @var EntityDebugDumper
28
     */
29
    private static $dumper;
30
31
    public function setup()
32
    {
33
        parent::setUp();
34
        if (false === self::$built) {
35
            $this->getTestCodeGenerator()
36
                 ->copyTo(self::WORK_DIR);
37
            self::$built = true;
38
        }
39
        $this->setupCopiedWorkDir();
40
    }
41
42
    public static function setUpBeforeClass()
43
    {
44
        parent::setUpBeforeClass();
45
        self::$dumper = new EntityDebugDumper();
46
    }
47
48
    /**
49
     * @test
50
     */
51
    public function itRemovesTrailingZerosOnDecimals(): string
52
    {
53
        $dump = self::$dumper->dump($this->getEntity());
54
        self::assertNotContains(self::VALUE_DECIMAL, $dump);
55
56
        return $dump;
57
    }
58
59
    private function getEntity(): EntityInterface
60
    {
61
        $emailAddressDto = $this->getEntityDtoFactory()
62
                                ->createEmptyDtoFromEntityFqn(
63
                                    $this->getCopiedFqn(
64
                                        self::TEST_ENTITIES_ROOT_NAMESPACE . TestCodeGenerator::TEST_ENTITY_EMAIL
65
                                    )
66
                                )->setEmailAddress('[email protected]');
67
68
        $personDto = $this->getEntityDtoFactory()
69
                          ->createEmptyDtoFromEntityFqn($this->getCopiedFqn(self::TEST_ENTITY_FQN))
70
                          ->setDecimal(self::VALUE_DECIMAL);
71
        $personDto->getAttributesEmails()->add($emailAddressDto);
72
        $this->getDataFillerFactory()
73
             ->getInstanceFromEntityFqn($this->getCopiedFqn(self::TEST_ENTITY_FQN))
74
             ->updateDtoWithFakeData($personDto);
75
76
        $entity = $this->createEntity(
77
            $this->getCopiedFqn(self::TEST_ENTITY_FQN),
78
            $personDto
79
        );
80
81
        return $entity;
82
    }
83
84
    /**
85
     * @test
86
     * @depends itRemovesTrailingZerosOnDecimals
87
     */
88
    public function itConvertsCollectionsToAListOfIDs(string $dump): void
89
    {
90
        self::assertStringContainsString(
91
            '[getAttributesEmails] => Array
92
        (
93
            [0] => EntityDebugDumperTest_ItRemovesTrailingZerosOnDecimals_\Entities\Attributes\Email:',
94
            $dump
95
        );
96
    }
97
}
98