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 (#101)
by joseph
18:59
created

ValidationExceptionTest.php$0 ➔ loadMetadata()   A

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\Tests\Small\Exception;
4
5
use Doctrine\Common\PropertyChangedListener;
6
use Doctrine\ORM\EntityManagerInterface;
7
use Doctrine\ORM\Mapping\ClassMetadata as DoctrineClassMetaData;
8
use EdmondsCommerce\DoctrineStaticMeta\Entity\Interfaces\EntityInterface;
9
use EdmondsCommerce\DoctrineStaticMeta\Entity\Interfaces\Validation\EntityValidatorInterface;
10
use EdmondsCommerce\DoctrineStaticMeta\Exception\ValidationException;
11
use PHPUnit\Framework\TestCase;
12
use Symfony\Component\Validator\ConstraintViolationList;
13
use Symfony\Component\Validator\Mapping\ClassMetadata as ValidatorClassMetaData;
14
15
/**
16
 * Class ValidationExceptionTest
17
 *
18
 * @package EdmondsCommerce\DoctrineStaticMeta\Exception
19
 * @SuppressWarnings(PHPMD.UnusedLocalVariable)
20
 * @coversDefaultClass \EdmondsCommerce\DoctrineStaticMeta\Exception\ValidationException
21
 */
22
class ValidationExceptionTest extends TestCase
23
{
24
    /**
25
     * @var ValidationException
26
     */
27
    private $exception;
28
29
    private $errors;
30
31
    private $entity;
32
33
    /**
34
     * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
35
     */
36
    public function setup()
37
    {
38
        try {
39
            $this->errors = new ConstraintViolationList();
40
            $this->entity = new class implements EntityInterface
41
            {
42
                public function getId()
43
                {
44
                    return;
45
                }
46
47
                public static function loadMetadata(DoctrineClassMetaData $metadata): void
48
                {
49
                    return;
50
                }
51
52
                public static function getPlural(): string
53
                {
54
                    return '';
55
                }
56
57
                public static function getSingular(): string
58
                {
59
                    return '';
60
                }
61
62
                public static function getIdField(): string
63
                {
64
                    return '';
65
                }
66
67
                public function getShortName(): string
68
                {
69
                    return '';
70
                }
71
72
                public function debug(int $level = 0): string
0 ignored issues
show
Unused Code introduced by
The parameter $level is not used and could be removed. ( Ignorable by Annotation )

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

72
                public function debug(/** @scrutinizer ignore-unused */ int $level = 0): string

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
73
                {
74
                    return '';
75
                }
76
77
                public static function loadValidatorMetaData(ValidatorClassMetaData $metadata): void
78
                {
79
                    return;
80
                }
81
82
                public function injectValidator(EntityValidatorInterface $validator)
83
                {
84
                    return;
85
                }
86
87
                public function isValid(): bool
88
                {
89
                    return false;
90
                }
91
92
                public function validate()
93
                {
94
                    return;
95
                }
96
97
                public function validateProperty(string $propertyName)
98
                {
99
                    return;
100
                }
101
102
103
                /**
104
                 * Adds a listener that wants to be notified about property changes.
105
                 *
106
                 * @param PropertyChangedListener $listener
107
                 *
108
                 * @return void
109
                 */
110
                public function addPropertyChangedListener(PropertyChangedListener $listener): void
111
                {
112
                    return;
113
                }
114
115
                public function getGetters(): array
116
                {
117
                    return [];
118
                }
119
120
                public function getSetters(): array
121
                {
122
                    return [];
123
                }
124
125
                public function notifyEmbeddablePrefixedProperties(
126
                    string $embeddablePropertyName,
127
                    ?string $propName = null,
128
                    $oldValue = null,
129
                    $newValue = null
130
                ): void {
131
                    return;
132
                }
133
134
                public function ensureMetaDataIsSet(EntityManagerInterface $entityManager): void
135
                {
136
                    return;
137
                }
138
            };
139
            throw new ValidationException($this->errors, $this->entity);
140
        } catch (ValidationException $e) {
141
            $this->exception = $e;
142
        }
143
    }
144
145
    /**
146
     * @test
147
     * @small
148
     * @covers ::getInvalidEntity
149
     */
150
    public function getInvalidEntity(): void
151
    {
152
        $expected = $this->entity;
153
        $actual   = $this->exception->getInvalidEntity();
154
        self::assertSame($expected, $actual);
155
    }
156
157
    /**
158
     * @test
159
     * @small
160
     * @covers ::getValidationErrors
161
     */
162
    public function getValidationErrors(): void
163
    {
164
        $expected = $this->errors;
165
        $actual   = $this->exception->getValidationErrors();
166
        self::assertSame($expected, $actual);
167
    }
168
}
169