Completed
Push — master ( fb76d4...3d7536 )
by Marcin
03:03
created

NipTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 27
rs 10
c 1
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testNipValid() 0 7 1
A testNipInvalidChecksum() 0 4 1
A testNipInvalidRegex() 0 4 1
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 testNipValid()
22
    {
23
        $defNr = '526-10-40-828';
24
        $res   = new Nip($defNr);
25
        $this->assertEquals('5261040828', $res->get());
26
        $this->assertEquals('string', gettype($res->getTaxOffice()));
27
    }
28
29
    /**
30
     * @expectedException \mrcnpdlk\Validator\Exception
31
     */
32
    public function testNipInvalidChecksum()
33
    {
34
        new Nip('5261040829');
35
    }
36
37
    /**
38
     * @expectedException \mrcnpdlk\Validator\Exception
39
     */
40
    public function testNipInvalidRegex()
41
    {
42
        new Nip('526104088');
43
    }
44
45
}
46