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 ( da7376...acbc08 )
by Grzegorz
11:18
created

PeselValidatorTest::getStrictValidPeselNumbers()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Polish Validator Bundle package.
5
 *
6
 * (c) Grzegorz Koziński
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Kiczort\PolishValidatorBundle\Tests\Constraints;
13
14
use Kiczort\PolishValidatorBundle\Validator\Constraints\Pesel;
15
use Kiczort\PolishValidatorBundle\Validator\Constraints\PeselValidator;
16
use Symfony\Component\Validator\Tests\Constraints\AbstractConstraintValidatorTest;
17
use Symfony\Component\Validator\Validation;
18
19
/**
20
 * @author Grzegorz Koziński <[email protected]>
21
 */
22
class PeselValidatorTest extends AbstractConstraintValidatorTest
0 ignored issues
show
Deprecated Code introduced by
The class Symfony\Component\Valida...ConstraintValidatorTest has been deprecated with message: Since Symfony 3.2, use ConstraintValidatorTestCase instead.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
23
{
24
    /**
25
     * @return PeselValidator
26
     */
27
    protected function createValidator()
28
    {
29
        return new PeselValidator();
30
    }
31
32
    public function testNullIsValid()
33
    {
34
        $this->validator->validate(null, new Pesel());
35
36
        $this->assertNoViolation();
37
    }
38
39
    public function testEmptyStringIsValid()
40
    {
41
        $this->validator->validate('', new Pesel());
42
43
        $this->assertNoViolation();
44
    }
45
46
    /**
47
     * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException
48
     */
49
    public function testExpectsStringCompatibleType()
50
    {
51
        $this->validator->validate(new \stdClass(), new Pesel());
52
    }
53
54
    /**
55
     * @dataProvider getNoneStrictValidPeselNumbers
56
     */
57
    public function testValidPesel($pesel)
58
    {
59
        $this->validator->validate($pesel, new Pesel());
60
61
        $this->assertNoViolation();
62
    }
63
64
    /**
65
     * @dataProvider getStrictValidPeselNumbers
66
     */
67
    public function testValidPeselStrict($pesel)
68
    {
69
        $this->validator->validate($pesel, new Pesel(array(
70
            'strict' => true,
71
        )));
72
73
        $this->assertNoViolation();
74
    }
75
76
    /**
77
     * @dataProvider getNoneStrictInvalidPeselNumbers
78
     */
79 View Code Duplication
    public function testInvalidPesel($pesel)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
80
    {
81
        $constraint = new Pesel(array(
82
            'message' => 'myMessage',
83
        ));
84
85
        $this->validator->validate($pesel, $constraint);
86
87
        $this->buildViolation('myMessage')
88
            ->setParameter('{{ value }}', '"' . $pesel . '"')
89
            ->assertRaised();
90
    }
91
92
    /**
93
     * @dataProvider getStrictInvalidPeselNumbers
94
     */
95 View Code Duplication
    public function testInvalidPeselStrict($pesel)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
96
    {
97
        $constraint = new Pesel(array(
98
            'strict' => true,
99
            'message' => 'myMessage',
100
        ));
101
102
        $this->validator->validate($pesel, $constraint);
103
104
        $this->buildViolation('myMessage')
105
            ->setParameter('{{ value }}', '"' . $pesel . '"')
106
            ->assertRaised();
107
    }
108
109
    /**
110
     * @return array
111
     */
112
    public function getNoneStrictValidPeselNumbers()
113
    {
114
        return array(
115
            array('55813111111'),
116
            array('44051401358'),
117
        );
118
    }
119
120
    /**
121
     * @return array
122
     */
123
    public function getStrictValidPeselNumbers()
124
    {
125
        return array(
126
            array('44051401359'),
127
        );
128
    }
129
130
    /**
131
     * @return array
132
     */
133
    public function getNoneStrictInvalidPeselNumbers()
134
    {
135
        return array(
136
            array('12314'),
137
            array('12314111111'),
138
            array('55813211111'),
139
            array('123a41f1111'),
140
        );
141
    }
142
143
    /**
144
     * @return array
145
     */
146
    public function getStrictInvalidPeselNumbers()
147
    {
148
        return array(
149
            array('44051401358'),
150
        );
151
    }
152
153
    protected function getApiVersion()
154
    {
155
        return Validation::API_VERSION_2_5_BC;
156
    }
157
}
158