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

NipValidatorTest   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 87
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
wmc 9
lcom 1
cbo 5
dl 0
loc 87
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A createValidator() 0 4 1
A testNullIsValid() 0 6 1
A testEmptyStringIsValid() 0 6 1
A testExpectsStringCompatibleType() 0 4 1
A testValidNip() 0 6 1
A testInvalidNip() 0 12 1
A getValidNipNumbers() 0 6 1
A getInvalidNipNumbers() 0 10 1
A getApiVersion() 0 4 1
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\Nip;
15
use Kiczort\PolishValidatorBundle\Validator\Constraints\NipValidator;
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 NipValidatorTest 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 NipValidator
26
     */
27
    protected function createValidator()
28
    {
29
        return new NipValidator();
30
    }
31
32
    public function testNullIsValid()
33
    {
34
        $this->validator->validate(null, new Nip());
35
36
        $this->assertNoViolation();
37
    }
38
39
    public function testEmptyStringIsValid()
40
    {
41
        $this->validator->validate('', new Nip());
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 Nip());
52
    }
53
54
    /**
55
     * @dataProvider getValidNipNumbers
56
     */
57
    public function testValidNip($nip)
58
    {
59
        $this->validator->validate($nip, new Nip());
60
61
        $this->assertNoViolation();
62
    }
63
64
    /**
65
     * @dataProvider getInvalidNipNumbers
66
     */
67
    public function testInvalidNip($nip)
68
    {
69
        $constraint = new Nip(array(
70
            'message' => 'myMessage',
71
        ));
72
73
        $this->validator->validate($nip, $constraint);
74
75
        $this->buildViolation('myMessage')
76
            ->setParameter('{{ value }}', '"' . $nip . '"')
77
            ->assertRaised();
78
    }
79
80
    /**
81
     * @return array
82
     */
83
    public function getValidNipNumbers()
84
    {
85
        return array(
86
            array('1234563218'),
87
        );
88
    }
89
90
    /**
91
     * @return array
92
     */
93
    public function getInvalidNipNumbers()
94
    {
95
        return array(
96
            array('123456789'),
97
            array('12345678901'),
98
            array('0000000000'),
99
            array('123456789a'),
100
            array('1234563217'),
101
        );
102
    }
103
104
    protected function getApiVersion()
105
    {
106
        return Validation::API_VERSION_2_5_BC;
107
    }
108
}
109