1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace SimpleSAML\XMLSecurity\Test\XML\ds; |
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\ds\AbstractDsElement; |
13
|
|
|
use SimpleSAML\XMLSecurity\XML\ds\AbstractDSAKeyValueType; |
14
|
|
|
use SimpleSAML\XMLSecurity\XML\ds\DSAKeyValue; |
15
|
|
|
use SimpleSAML\XMLSecurity\XML\ds\G; |
16
|
|
|
use SimpleSAML\XMLSecurity\XML\ds\J; |
17
|
|
|
use SimpleSAML\XMLSecurity\XML\ds\P; |
18
|
|
|
use SimpleSAML\XMLSecurity\XML\ds\PgenCounter; |
19
|
|
|
use SimpleSAML\XMLSecurity\XML\ds\Q; |
20
|
|
|
use SimpleSAML\XMLSecurity\XML\ds\Seed; |
21
|
|
|
use SimpleSAML\XMLSecurity\XML\ds\Y; |
22
|
|
|
|
23
|
|
|
use function dirname; |
24
|
|
|
use function strval; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Class \SimpleSAML\XMLSecurity\Test\XML\ds\DSAKeyValueTest |
28
|
|
|
* |
29
|
|
|
* @package simplesamlphp/xml-security |
30
|
|
|
*/ |
31
|
|
|
#[CoversClass(AbstractDsElement::class)] |
32
|
|
|
#[CoversClass(AbstractDSAKeyValueType::class)] |
33
|
|
|
#[CoversClass(DSAKeyValue::class)] |
34
|
|
|
final class DSAKeyValueTest extends TestCase |
35
|
|
|
{ |
36
|
|
|
use SchemaValidationTestTrait; |
|
|
|
|
37
|
|
|
use SerializableElementTestTrait; |
|
|
|
|
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
*/ |
41
|
|
|
public static function setUpBeforeClass(): void |
42
|
|
|
{ |
43
|
|
|
self::$testedClass = DSAKeyValue::class; |
44
|
|
|
|
45
|
|
|
self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xmldsig1-schema.xsd'; |
46
|
|
|
|
47
|
|
|
self::$xmlRepresentation = DOMDocumentFactory::fromFile( |
48
|
|
|
dirname(__FILE__, 3) . '/resources/xml/ds_DSAKeyValue.xml', |
49
|
|
|
); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
*/ |
55
|
|
|
public function testMarshalling(): void |
56
|
|
|
{ |
57
|
|
|
$p = new P('GpM1'); |
58
|
|
|
$q = new Q('GpM2'); |
59
|
|
|
$g = new G('GpM3'); |
60
|
|
|
$y = new Y('GpM4'); |
61
|
|
|
$j = new J('GpM5'); |
62
|
|
|
$seed = new Seed('GpM6'); |
63
|
|
|
$pgenCounter = new PgenCounter('GpM7'); |
64
|
|
|
|
65
|
|
|
$dsaKeyValue = new DSAKeyValue($y, $g, $j, $p, $q, $seed, $pgenCounter); |
66
|
|
|
|
67
|
|
|
$this->assertEquals( |
68
|
|
|
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), |
69
|
|
|
strval($dsaKeyValue), |
70
|
|
|
); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
*/ |
76
|
|
|
public function testMarshallingElementOrder(): void |
77
|
|
|
{ |
78
|
|
|
$p = new P('GpM1'); |
79
|
|
|
$q = new Q('GpM2'); |
80
|
|
|
$g = new G('GpM3'); |
81
|
|
|
$y = new Y('GpM4'); |
82
|
|
|
$j = new J('GpM5'); |
83
|
|
|
$seed = new Seed('GpM6'); |
84
|
|
|
$pgenCounter = new PgenCounter('GpM7'); |
85
|
|
|
|
86
|
|
|
$dsaKeyValue = new DSAKeyValue($y, $g, $j, $p, $q, $seed, $pgenCounter); |
87
|
|
|
|
88
|
|
|
$dsaKeyValueElement = $dsaKeyValue->toXML(); |
89
|
|
|
/** @var \DOMElement[] $children */ |
90
|
|
|
$children = $dsaKeyValueElement->childNodes; |
91
|
|
|
|
92
|
|
|
$this->assertEquals('ds:P', $children[0]->tagName); |
93
|
|
|
$this->assertEquals('ds:Q', $children[1]->tagName); |
94
|
|
|
$this->assertEquals('ds:G', $children[2]->tagName); |
95
|
|
|
$this->assertEquals('ds:Y', $children[3]->tagName); |
96
|
|
|
$this->assertEquals('ds:J', $children[4]->tagName); |
97
|
|
|
$this->assertEquals('ds:Seed', $children[5]->tagName); |
98
|
|
|
$this->assertEquals('ds:PgenCounter', $children[6]->tagName); |
99
|
|
|
} |
100
|
|
|
} |
101
|
|
|
|
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