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

CustomSignableTest::testUnmarshalling()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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