Passed
Push — master ( be09b3...67068d )
by Tim
13:28
created

X509SubjectNameTest::testUnmarshalling()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\XMLSecurity\Test\XML\ds;
6
7
use PHPUnit\Framework\TestCase;
8
use SimpleSAML\XML\DOMDocumentFactory;
9
use SimpleSAML\XML\TestUtils\SerializableElementTestTrait;
10
use SimpleSAML\XMLSecurity\XML\ds\X509SubjectName;
11
12
use function dirname;
13
use function strval;
14
15
/**
16
 * Class \SimpleSAML\XMLSecurity\Test\XML\ds\X509SubjectNameTest
17
 *
18
 * @covers \SimpleSAML\XMLSecurity\XML\ds\AbstractDsElement
19
 * @covers \SimpleSAML\XMLSecurity\XML\ds\X509SubjectName
20
 *
21
 * @package simplesamlphp/xml-security
22
 */
23
final class X509SubjectNameTest extends TestCase
24
{
25
    use SerializableElementTestTrait;
0 ignored issues
show
Bug introduced by
The trait SimpleSAML\XML\TestUtils...lizableElementTestTrait requires the property $documentElement which is not provided by SimpleSAML\XMLSecurity\T...\ds\X509SubjectNameTest.
Loading history...
26
27
    /**
28
     */
29
    public static function setUpBeforeClass(): void
30
    {
31
        self::$testedClass = X509SubjectName::class;
32
33
        self::$xmlRepresentation = DOMDocumentFactory::fromFile(
34
            dirname(__FILE__, 3) . '/resources/xml/ds_X509SubjectName.xml',
35
        );
36
    }
37
38
39
    /**
40
     */
41
    public function testMarshalling(): void
42
    {
43
        $subjectName = new X509SubjectName('some name');
44
45
        $this->assertEquals(
46
            self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
47
            strval($subjectName),
48
        );
49
    }
50
}
51