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

NipTest::testNipValid()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 5
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\Nip;
18
19
class NipTest extends TestCase
20
{
21
    public function setUp()
22
    {
23
        parent::setUp();
24
    }
25
26
    public function testNipValid()
27
    {
28
        $defNr = '526-10-40-828';
29
        $res   = new Nip($defNr);
30
        $this->assertEquals('5261040828', $res->get());
31
        $this->assertEquals('string', gettype($res->getTaxOffice()));
32
    }
33
34
    /**
35
     * @expectedException \mrcnpdlk\Validator\Exception
36
     */
37
    public function testNipInvalid()
38
    {
39
        $res = new Nip('526104088');
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...
40
    }
41
42
}
43