Passed
Push — master ( 03ebed...75e2c8 )
by Marcin
02:17
created

IDCardTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 23
c 0
b 0
f 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testIDCardValid() 0 6 1
A testIDCardInvalid() 0 4 1
1
<?php
2
3
namespace mrcnpdlk\Validator;
4
5
6
use mrcnpdlk\Validator\Types\IDCard;
7
8
class IDCardTest extends TestCase
9
{
10
    public function setUp()
11
    {
12
        parent::setUp();
13
    }
14
15
    public function testIDCardValid()
16
    {
17
        $defNr = 'AHA051591';
18
        $res = new IDCard($defNr);
19
        $this->assertEquals($defNr,$res->get());
20
    }
21
22
    /**
23
     * @expectedException \mrcnpdlk\Validator\Exception
24
     */
25
    public function testIDCardInvalid()
26
    {
27
        $res = new IDCard('AHA051590');
0 ignored issues
show
Unused Code introduced by
$res is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
28
    }
29
30
}
31