Completed
Push — master ( 1b8832...297118 )
by Alexander
11:04
created

IpNetCalcTest::testCalcNetSumException()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace IpNetCalc;
4
5
/**
6
 * Class IpNetCalcTest
7
 * @package IpNetCalc
8
 *
9
 * @author Alexander Over <[email protected]>
10
 */
11
class IpNetCalcTest extends \PHPUnit_Framework_TestCase
12
{
13
    /** @var IpNetCalc */
14
    protected $class;
15
16
    /**
17
     * Dataprovider for Test
18
     * @return array
19
     */
20
    public function dpCalcNetSum()
21
    {
22
        return [
23
            [['192.168.0.1', '192.168.2.40'], '192.168.0.0/22'],
24
            [['2a00:1450:8004::69', '2001:1af8:1:f006::6'], '2000::/4'],
25
            [['127.0.0.1', '127.0.0.1'], '127.0.0.1/32'],
26
        ];
27
    }
28
29
    /**
30
     *
31
     */
32
    public function setup()
33
    {
34
        $this->class = new IpNetCalc();
35
    }
36
37
    /**
38
     * @dataProvider dpCalcNetSum
39
     * @param $data
40
     * @param $expected
41
     */
42
    public function testCalcNetSum($data, $expected)
43
    {
44
        $this->assertEquals($expected, $this->class->calcNetSum($data));
45
    }
46
47
    /**
48
     * @expectedException \InvalidArgumentException
49
     */
50
    public function testCalcNetSumException() {
51
        $this->assertEquals([], $this->class->calcNetSum(['', '']));
52
    }
53
}
54