Completed
Push — master ( 666d36...a3ce9d )
by Sam
02:53
created

AplTest::testGetters()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 9.7
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of Badcow DNS Library.
5
 *
6
 * (c) Samuel Williams <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Badcow\DNS\Tests\Rdata;
13
14
use Badcow\DNS\Rdata\APL;
15
use Badcow\DNS\Rdata\Factory;
16
use PHPUnit\Framework\TestCase;
17
18
class AplTest extends TestCase
19
{
20
    public function testOutput()
21
    {
22
        $includedRanges = [
23
            \IPBlock::create('192.168.0.0/23'),
24
            \IPBlock::create('2001:acad:1::/112'),
25
        ];
26
27
        $excludedRanges = [
28
            \IPBlock::create('192.168.1.64/28'),
29
            \IPBlock::create('2001:acad:1::8/128'),
30
        ];
31
32
        $apl = Factory::Apl($includedRanges, $excludedRanges);
33
34
        $expectation = '1:192.168.0.0/23 2:2001:acad:1::/112 !1:192.168.1.64/28 !2:2001:acad:1::8/128';
35
        $this->assertEquals($expectation, $apl->output());
36
    }
37
38
    public function testGetters()
39
    {
40
        $includedRanges = [
41
            \IPBlock::create('192.168.0.0/23'),
42
            \IPBlock::create('2001:acad:1::/112'),
43
        ];
44
45
        $excludedRanges = [
46
            \IPBlock::create('192.168.1.64/28'),
47
            \IPBlock::create('2001:acad:1::8/128'),
48
        ];
49
50
        $apl = Factory::Apl($includedRanges, $excludedRanges);
51
52
        $this->assertEquals($includedRanges, $apl->getIncludedAddressRanges());
53
        $this->assertEquals($excludedRanges, $apl->getExcludedAddressRanges());
54
    }
55
}
56