Passed
Pull Request — master (#61)
by
unknown
12:50
created

InclusiveNamespacesTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 30
rs 10
wmc 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\XMLSecurity\Test\XML\ec;
6
7
use PHPUnit\Framework\Attributes\CoversClass;
8
use PHPUnit\Framework\TestCase;
9
use SimpleSAML\XML\DOMDocumentFactory;
10
use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait;
11
use SimpleSAML\XML\TestUtils\SerializableElementTestTrait;
12
use SimpleSAML\XMLSecurity\XML\ec\AbstractEcElement;
13
use SimpleSAML\XMLSecurity\XML\ec\InclusiveNamespaces;
14
15
use function dirname;
16
use function strval;
17
18
/**
19
 * Class \SimpleSAML\XMLSecurity\Test\XML\ec\InclusiveNamespacesTest
20
 *
21
 * @package simplesamlphp/xml-security
22
 */
23
#[CoversClass(AbstractEcElement::class)]
24
#[CoversClass(InclusiveNamespaces::class)]
25
class InclusiveNamespacesTest extends TestCase
26
{
27
    use SchemaValidationTestTrait;
28
    use SerializableElementTestTrait;
29
30
    /**
31
     */
32
    public static function setUpBeforeClass(): void
33
    {
34
        self::$testedClass = InclusiveNamespaces::class;
35
36
        self::$xmlRepresentation = DOMDocumentFactory::fromFile(
37
            dirname(__FILE__, 3) . '/resources/xml/ec_InclusiveNamespaces.xml',
38
        );
39
    }
40
41
42
    public function testMarshalling(): void
43
    {
44
        $inclusiveNamespaces = new InclusiveNamespaces(["dsig", "soap"]);
45
46
        $this->assertCount(2, $inclusiveNamespaces->getPrefixes());
47
        $this->assertEquals("dsig", $inclusiveNamespaces->getPrefixes()[0]);
48
        $this->assertEquals("soap", $inclusiveNamespaces->getPrefixes()[1]);
49
50
        $this->assertEquals(
51
            self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
52
            strval($inclusiveNamespaces),
53
        );
54
    }
55
}
56