Completed
Push — master ( 75e2c8...ed4354 )
by Marcin
07:06
created

PeselTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * Validator
4
 *
5
 * Copyright (c) 2017 pudelek.org.pl
6
 *
7
 * @license MIT License (MIT)
8
 *
9
 * For the full copyright and license information, please view source file
10
 * that is bundled with this package in the file LICENSE
11
 *
12
 * @author Marcin Pudełek <[email protected]>
13
 */
14
15
namespace mrcnpdlk\Validator;
16
17
use mrcnpdlk\Validator\Types\Pesel;
18
19
class PeselTest extends TestCase
20
{
21
    public function setUp()
22
    {
23
        parent::setUp();
24
    }
25
26
    public function testPeselValid()
27
    {
28
        $defNr = '12271402999';
29
        $res   = new Pesel($defNr);
30
        $this->assertEquals('12271402999', $res->get());
31
        $this->assertEquals('2012-07-14', $res->getBirthDate());
32
        $this->assertEquals(Pesel::SEX_M, $res->getSex());
33
    }
34
35
    /**
36
     * @expectedException \mrcnpdlk\Validator\Exception
37
     */
38
    public function testPeselInvalid()
39
    {
40
        $res = new Pesel('12271402990');
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...
41
    }
42
43
}
44