Passed
Push — master ( feb95e...9f38d8 )
by Tim
01:59
created

CustomSignableTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
dl 0
loc 41
rs 10
c 1
b 0
f 0
wmc 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\XMLSecurity\Test\XML;
6
7
use PHPUnit\Framework\Attributes\CoversClass;
8
use PHPUnit\Framework\TestCase;
9
use SimpleSAML\XML\DOMDocumentFactory;
10
use SimpleSAML\XML\TestUtils\SerializableElementTestTrait;
11
use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait;
12
13
use function dirname;
14
use function strval;
15
16
/**
17
 * Class \SimpleSAML\XMLSecurity\Test\XML\CustomSignableTest
18
 *
19
 * @package simplesamlphp/xml-security
20
 */
21
#[CoversClass(CustomSignable::class)]
22
final class CustomSignableTest extends TestCase
23
{
24
    use SerializableElementTestTrait;
25
    use SignedElementTestTrait;
26
27
28
    /**
29
     * Load a fixture.
30
     */
31
    public static function setUpBeforeClass(): void
32
    {
33
        self::$testedClass = CustomSignable::class;
34
35
        self::$xmlRepresentation = DOMDocumentFactory::fromFile(
36
            dirname(__FILE__, 2) . '/resources/xml/custom_CustomSignable.xml',
37
        );
38
    }
39
40
41
    /**
42
     * No marshalling test, because the constructor is private
43
     */
44
45
46
    /**
47
     */
48
    public function testMarshalling(): void
49
    {
50
        $document = DOMDocumentFactory::fromString(
51
            <<<XML
52
<ssp:CustomSignable xmlns:ssp="urn:x-simplesamlphp:namespace"><ssp:Chunk>Some</ssp:Chunk></ssp:CustomSignable>
53
XML
54
            ,
55
        );
56
57
        $customSignable = new CustomSignable($document->documentElement, null);
58
59
        $this->assertEquals(
60
            self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
61
            strval($customSignable),
62
        );
63
    }
64
}
65