Completed
Push — master ( c08b12...d995e7 )
by Davide
02:13
created

CheckerTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 3
dl 0
loc 65
rs 10
1
<?php
2
namespace DavidePastore\CodiceFiscale;
3
4
/**
5
 * Test for the Checker class.
6
 * @author davidepastore
7
 *
8
 */
9
class CheckerTest extends \PHPUnit_Framework_TestCase {
10
    
11
    /**
12
	 * Test for check.
13
     * @dataProvider checkerProvider
14
	 */
15
	public function testAllLevels($subject, $codiceFiscaleToCheck, $omocodiaLevel, $expected){
16
        $checker = new Checker($subject, array(
17
            "codiceFiscaleToCheck" => $codiceFiscaleToCheck,
18
            "omocodiaLevel" => $omocodiaLevel
19
        ));
20
		$actual = $checker->check();
21
		$this->assertEquals($expected, $actual);
22
	}
23
    
24
    /**
25
     * The checker provider.
26
     */
27
    public function checkerProvider(){
28
        return array(
29
          array(
30
            new Subject(
31
              array(
32
                "name" => "Mario",
33
                "surname" => "Rossi",
34
                "birthDate" => "1985-12-10",
35
                "gender" => "M",
36
                "belfioreCode" => "A562"
37
              )
38
            ),
39
            "RSSMRA85T10A562S",
40
            0,
41
            true
42
          ),
43
          array(
44
            new Subject(
45
              array(
46
                "name" => "Mario",
47
                "surname" => "Rossi",
48
                "birthDate" => "1985-12-10",
49
                "gender" => "M",
50
                "belfioreCode" => "A562"
51
              )
52
            ),
53
            "RSSMRA85T10A562S",
54
            2,
55
            false
56
          ),
57
          array(
58
            new Subject(
59
              array(
60
                "name" => "Roberto",
61
                "surname" => "Santi",
62
                "birthDate" => "1963-05-08",
63
                "gender" => "M",
64
                "belfioreCode" => "H501"
65
              )
66
            ),
67
            "SNTRRT63E08H50ML",
68
            Checker::ALL_OMOCODIA_LEVELS,
69
            true
70
          )
71
        );
72
    }
73
}
74