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

NrbTest::testBankAccountInvalidBankDepartment()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
dl 0
loc 4
rs 10
c 1
b 1
f 0
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
18
use mrcnpdlk\Validator\Types\Nrb;
19
20
class NrbTest extends TestCase
21
{
22
    public function testBankAccountValid()
23
    {
24
        $defNr = '13 1020-2791 2123 5389 7801 0731';
25
        $res = new Nrb($defNr);
26
        $this->assertEquals('13102027912123538978010731',$res->get());
27
        $this->assertEquals('102',$res->getBank());
28
        $this->assertEquals('10202791',$res->getBankDepartment());
29
    }
30
31
    /**
32
     * @expectedException \mrcnpdlk\Validator\Exception
33
     */
34
    public function testBankAccountInvalidChecksum()
35
    {
36
        new Nrb('13102027912123538978010730');
37
    }
38
    /**
39
     * @expectedException \mrcnpdlk\Validator\Exception
40
     */
41
    public function testBankAccountInvalidRegex()
42
    {
43
        new Nrb('131020279121235389780aaa');
44
    }
45
46
    /**
47
     * @expectedException \mrcnpdlk\Validator\Exception
48
     */
49
    public function testBankAccountInvalidBankDepartment()
50
    {
51
        new Nrb('04 0000 0000 0000 0000 0000 0000');
52
    }
53
54
}
55