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

CaaRdataTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 3
dl 0
loc 36
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testOutput() 0 10 1
A testFlagException() 0 5 1
A testTagException() 0 5 1
A testGetType() 0 4 1
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\CAA;
15
use Badcow\DNS\Rdata\Factory;
16
17
class CaaRdataTest extends \PHPUnit\Framework\TestCase
18
{
19
    public function testOutput()
20
    {
21
        $caa = Factory::Caa(0, 'issue', 'letsencrypt.org');
22
23
        $expectation = '0 issue "letsencrypt.org"';
24
25
        $this->assertEquals($expectation, $caa->output());
26
        $this->assertEquals(0, $caa->getFlag());
27
        $this->assertEquals('issue', $caa->getTag());
28
    }
29
30
    /**
31
     * @expectedException \InvalidArgumentException
32
     */
33
    public function testFlagException()
34
    {
35
        $srv = new CAA();
36
        $srv->setFlag(CAA::MAX_FLAG + 1);
37
    }
38
39
    /**
40
     * @expectedException \InvalidArgumentException
41
     */
42
    public function testTagException()
43
    {
44
        $srv = new CAA();
45
        $srv->setTag('not_exist');
46
    }
47
48
    public function testGetType()
49
    {
50
        $this->assertEquals('CAA', (new CAA())->getType());
51
    }
52
}
53