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
Push — master ( f20003...f7764e )
by Ross
17s queued 11s
created

JsonValidatorTest   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 21
dl 0
loc 64
rs 10
c 0
b 0
f 0
wmc 7

5 Methods

Rating   Name   Duplication   Size   Complexity  
A provideInvalid() 0 4 2
A provideValid() 0 4 2
A createValidator() 0 3 1
A violationsForInvalidValues() 0 8 1
A noViolationsForValidValues() 0 5 1
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\Tests\Small\Validation\Constraints\FieldConstraints;
4
5
use EdmondsCommerce\DoctrineStaticMeta\Entity\Validation\Constraints\FieldConstraints\JsonData;
6
use EdmondsCommerce\DoctrineStaticMeta\Entity\Validation\Constraints\FieldConstraints\JsonDataValidator;
7
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
8
9
class JsonValidatorTest extends ConstraintValidatorTestCase
10
{
11
    public const VALID = [
12
        '{"testArray": [1,2,3]}' ,
13
        '{"testObject":{ "firstVar": "a string", "secondVar": 123}}',
14
        'false',
15
    ];
16
17
    public const INVALID = [
18
        '{"malformedObject"',
19
        '{"missingQuotes": in a string}',
20
        '{"missingCommas": "between" "different":"values"}',
21
    ];
22
23
    public function provideValid(): \Generator
24
    {
25
        foreach (self::VALID as $value) {
26
            yield $value => [$value];
27
        }
28
    }
29
30
    /**
31
     * @test
32
     * @small
33
     *
34
     * @param string $value
35
     *
36
     * @dataProvider provideValid
37
     */
38
    public function noViolationsForValidValues(string $value): void
39
    {
40
        $this->validator->validate($value, new JsonData());
41
42
        $this->assertNoViolation();
43
    }
44
45
    public function provideInvalid(): \Generator
46
    {
47
        foreach (self::INVALID as $value) {
48
            yield $value => [$value];
49
        }
50
    }
51
52
    /**
53
     * @test
54
     * @small
55
     *
56
     * @param string $value
57
     *
58
     * @dataProvider provideInvalid
59
     */
60
    public function violationsForInvalidValues(string $value): void
61
    {
62
        $this->validator->validate($value, new JsonData());
63
64
        $this->buildViolation(JsonData::MESSAGE)
65
             ->setParameter('{{ string }}', $value)
66
             ->setParameter('{{ error }}', 'Syntax error')
67
             ->assertRaised();
68
    }
69
70
    protected function createValidator()
71
    {
72
        return new JsonDataValidator();
73
    }
74
}
75