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