Skip to content

Commit e2b2b0c

Browse files
committed
Raise coverage
1 parent 55defa2 commit e2b2b0c

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

src/XML/ds/X509Data.php

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
use DOMElement;
88
use SimpleSAML\Assert\Assert;
99
use SimpleSAML\XML\Chunk;
10-
use SimpleSAML\XML\Constants as C;
1110
use SimpleSAML\XML\Exception\InvalidDOMElementException;
11+
use SimpleSAML\XMLSecurity\Constants as C;
1212
use SimpleSAML\XMLSecurity\Exception\InvalidArgumentException;
1313
use SimpleSAML\XMLSecurity\XML\dsig11\X509Digest;
1414

@@ -74,18 +74,22 @@ public static function fromXML(DOMElement $xml): static
7474
for ($n = $xml->firstChild; $n !== null; $n = $n->nextSibling) {
7575
if (!($n instanceof DOMElement)) {
7676
continue;
77-
} elseif ($n->namespaceURI !== self::NS) {
77+
} elseif ($n->namespaceURI === self::NS) {
78+
$data[] = match ($n->localName) {
79+
'X509Certificate' => X509Certificate::fromXML($n),
80+
'X509IssuerSerial' => X509IssuerSerial::fromXML($n),
81+
'X509SubjectName' => X509SubjectName::fromXML($n),
82+
default => new Chunk($n),
83+
};
84+
} elseif ($n->namespaceURI === C::NS_XDSIG11) {
85+
$data[] = match ($n->localName) {
86+
'X509Digest' => X509Digest::fromXML($n),
87+
default => new Chunk($n),
88+
};
89+
} else {
7890
$data[] = new Chunk($n);
7991
continue;
8092
}
81-
82-
$data[] = match ($n->localName) {
83-
'X509Certificate' => X509Certificate::fromXML($n),
84-
'X509IssuerSerial' => X509IssuerSerial::fromXML($n),
85-
'X509SubjectName' => X509SubjectName::fromXML($n),
86-
'X509Digest' => X509Digest::fromXML($n),
87-
default => new Chunk($n),
88-
};
8993
}
9094

9195
return new static($data);

tests/XML/ds/ReferenceTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public function testMarshalling(): void
6464
'#_1e280ee704fb1d8d9dec4bd6c1889ec96942921153',
6565
);
6666

67+
$this->assertFalse($reference->isXPointer());
6768
$this->assertEquals(
6869
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
6970
strval($reference),

0 commit comments

Comments
 (0)