1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace SimpleSAML\Test\SAML2\XML\xenc11; |
6
|
|
|
|
7
|
|
|
use PHPUnit\Framework\Attributes\CoversClass; |
|
|
|
|
8
|
|
|
use PHPUnit\Framework\TestCase; |
9
|
|
|
use SimpleSAML\XML\Attribute as XMLAttribute; |
10
|
|
|
use SimpleSAML\XML\Chunk; |
11
|
|
|
use SimpleSAML\XML\DOMDocumentFactory; |
12
|
|
|
use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; |
13
|
|
|
use SimpleSAML\XMLSecurity\XML\xenc11\AbstractXenc11Element; |
14
|
|
|
use SimpleSAML\XMLSecurity\XML\xenc11\Parameters; |
15
|
|
|
|
16
|
|
|
use function dirname; |
17
|
|
|
use function strval; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Class \SimpleSAML\XMLSecurity\XML\xenc11\ParametersTest |
21
|
|
|
* |
22
|
|
|
* @package simplesamlphp/xml-security |
23
|
|
|
*/ |
24
|
|
|
#[CoversClass(Parameters::class)] |
25
|
|
|
#[CoversClass(AbstractXenc11Element::class)] |
26
|
|
|
final class ParametersTest extends TestCase |
27
|
|
|
{ |
28
|
|
|
use SerializableElementTestTrait; |
|
|
|
|
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
*/ |
32
|
|
|
public static function setUpBeforeClass(): void |
33
|
|
|
{ |
34
|
|
|
self::$testedClass = Parameters::class; |
35
|
|
|
|
36
|
|
|
self::$xmlRepresentation = DOMDocumentFactory::fromFile( |
37
|
|
|
dirname(__FILE__, 3) . '/resources/xml/xenc11_Parameters.xml', |
38
|
|
|
); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
|
42
|
|
|
// marshalling |
43
|
|
|
|
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
*/ |
47
|
|
|
public function testMarshalling(): void |
48
|
|
|
{ |
49
|
|
|
$chunk = new Chunk(DOMDocumentFactory::fromString( |
50
|
|
|
<<<XML |
51
|
|
|
<ssp:AuthenticationContextDeclaration xmlns:ssp="urn:x-simplesamlphp:namespace"> |
52
|
|
|
<ssp:Identification nym="verinymity"> |
53
|
|
|
<ssp:Extension> |
54
|
|
|
<ssp:NoVerification/> |
55
|
|
|
</ssp:Extension> |
56
|
|
|
</ssp:Identification> |
57
|
|
|
</ssp:AuthenticationContextDeclaration> |
58
|
|
|
XML |
59
|
|
|
, |
60
|
|
|
)->documentElement); |
61
|
|
|
|
62
|
|
|
$parameters = new Parameters( |
63
|
|
|
[$chunk], |
64
|
|
|
[new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1')], |
65
|
|
|
); |
66
|
|
|
|
67
|
|
|
$this->assertEquals( |
68
|
|
|
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), |
69
|
|
|
strval($parameters), |
70
|
|
|
); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Adding an empty Parameters element should yield an empty element. |
76
|
|
|
*/ |
77
|
|
|
public function testMarshallingEmptyElement(): void |
78
|
|
|
{ |
79
|
|
|
$xenc11_ns = Parameters::NS; |
80
|
|
|
$parameters = new Parameters(); |
81
|
|
|
$this->assertEquals( |
82
|
|
|
"<xenc11:Parameters xmlns:xenc11=\"$xenc11_ns\"/>", |
83
|
|
|
strval($parameters), |
84
|
|
|
); |
85
|
|
|
$this->assertTrue($parameters->isEmptyElement()); |
86
|
|
|
} |
87
|
|
|
} |
88
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths