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

RegonTest::testRegonInvalid()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
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
use mrcnpdlk\Validator\Types\Regon;
18
19
class RegonTest extends TestCase
20
{
21
    public function testRegonValid()
22
    {
23
        $defNr = '331501';
24
        $res   = new Regon($defNr);
25
        $this->assertEquals('000331501', $res->get());
26
    }
27
28
    public function testRegonLongValid()
29
    {
30
        $defNr = '47051837100020';
31
        $res   = new Regon($defNr);
32
        $this->assertEquals('470518371', $res->getShort());
33
        $this->assertEquals('47051837100020', $res->getLong());
34
    }
35
36
    /**
37
     * @expectedException \mrcnpdlk\Validator\Exception
38
     */
39
    public function testRegonInvalidChecksum()
40
    {
41
        new Regon('000331502');
42
    }
43
44
    /**
45
     * @expectedException \mrcnpdlk\Validator\Exception
46
     */
47
    public function testRegonInvalidRegex()
48
    {
49
        new Regon('0003315021');
50
    }
51
52
}
53