Completed
Push — master ( 3ced6b...53bd9f )
by Marcin
01:36
created

PnaTest::testCreate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
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\Pna;
18
19
class PnaTest extends TestCase
20
{
21 View Code Duplication
    public function testPnaValidShort()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
22
    {
23
        $defNr = '90019';
24
        $this->assertTrue(Pna::isValid($defNr, false));
25
        $res   = new Pna($defNr);
26
        $this->assertEquals('90019', $res->get());
27
        $this->assertEquals('90019', $res->getShort());
28
        $this->assertEquals('90-019', $res->getLong());
29
    }
30 View Code Duplication
    public function testPnaValidLong()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
31
    {
32
        $defNr = '90-019';
33
        $this->assertTrue(Pna::isValid($defNr, false));
34
        $res   = new Pna($defNr);
35
        $this->assertEquals('90019', $res->get());
36
        $this->assertEquals('90019', $res->getShort());
37
        $this->assertEquals('90-019', $res->getLong());
38
    }
39
40
    public function testCreate()
41
    {
42
        $res = Pna::create('01-234');
43
        $this->assertEquals('01234', $res->get());
44
    }
45
46
    /**
47
     * @expectedException \mrcnpdlk\Validator\Exception
48
     */
49
    public function testPnaInvalid()
50
    {
51
        Pna::isValid('1-2345', true);
52
    }
53
54
}
55