Completed
Pull Request — master (#97)
by Sam
04:21
created

CdnskeyTest::testFactory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 12
Ratio 100 %

Importance

Changes 0
Metric Value
dl 12
loc 12
rs 9.8666
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of Badcow DNS Library.
7
 *
8
 * (c) Samuel Williams <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Badcow\DNS\Tests\Rdata;
15
16
use Badcow\DNS\Algorithms;
17
use Badcow\DNS\Rdata\CDNSKEY;
18
use Badcow\DNS\Rdata\Factory;
19
use PHPUnit\Framework\TestCase;
20
21
class CdnskeyTest extends TestCase
22
{
23
    /**
24
     * @var string
25
     */
26
    private static $publicKey = 'AQPSKmynfzW4kyBv015MUG2DeIQ3Cbl+BBZH4b/0PY1kxkmvHjcZc8nokfzj31GajIQKY+5CptLr3buXA10hWqTkF7H6RfoRqXQeogmMHfpftf6zMv1LyBUgia7za6ZEzOJBOztyvhjL742iU/TpPSEDhm2SNKLijfUppn1UaNvv4w==';
27
28 View Code Duplication
    public function testFactory(): void
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...
29
    {
30
        $cdnskey = Factory::CDNSKEY(256, Algorithms::RSASHA1, base64_decode(self::$publicKey));
31
        $output = '256 3 5 '.self::$publicKey;
32
33
        $this->assertInstanceOf(CDNSKEY::class, $cdnskey);
34
        $this->assertEquals(256, $cdnskey->getFlags());
35
        $this->assertEquals(5, $cdnskey->getAlgorithm());
36
        $this->assertEquals(base64_decode(self::$publicKey), $cdnskey->getPublicKey());
37
        $this->assertEquals(3, $cdnskey->getProtocol());
38
        $this->assertEquals($output, $cdnskey->toText());
39
    }
40
}
41