AfmTest::testInvalidAfms()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 10
Ratio 100 %

Importance

Changes 0
Metric Value
dl 10
loc 10
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace SymfonyGreekValidation;
4
5
use PHPUnit\Framework\TestCase;
6
use Symfony\Component\Validator\Validation;
7
8
class AfmTest extends TestCase
9
{
10
    /**
11
     * @dataProvider validAfmProvider
12
     */
13
    public function testValidAfms($afm)
14
    {
15
        $validator = Validation::createValidator();
16
17
        $violations = $validator->validate($afm, [
18
            new Afm(),
19
        ]);
20
21
        $this->assertEmpty($violations);
22
    }
23
24
    /**
25
     * @dataProvider invalidAfmProvider
26
     */
27 View Code Duplication
    public function testInvalidAfms($afm)
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...
28
    {
29
        $validator = Validation::createValidator();
30
31
        $violations = $validator->validate($afm, [
32
            new Afm(),
33
        ]);
34
35
        $this->assertNotEmpty($violations);
36
    }
37
38
    public function validAfmProvider()
39
    {
40
        return [
41
            [''],
42
            [null],
43
            ['094075243'],
44
            ['094079531'],
45
            ['997364193'],
46
            ['800785347'],
47
            ['094066928'],
48
            ['084256593'],
49
        ];
50
    }
51
52
    public function invalidAfmProvider()
53
    {
54
        return [
55
            ['026051931'],
56
            ['aaaa'],
57
        ];
58
    }
59
}
60