Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
"ext-dom": "*",

"simplesamlphp/assert": "~2.0",
"simplesamlphp/xml-common": "~2.8"
"simplesamlphp/xml-common": "dev-feature/dom-migration-php84"
},
"require-dev": {
"simplesamlphp/simplesamlphp-test-framework": "~1.11",
"simplesamlphp/xml-ws-addressing": "~1.3"
"simplesamlphp/xml-ws-addressing": "dev-feature/dom-migration-php84"
},
"autoload": {
"psr-4": {
Expand Down
11 changes: 5 additions & 6 deletions src/Utils/XPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

namespace SimpleSAML\WebServices\MetadataExchange\Utils;

use DOMNode;
use DOMXPath;
use Dom;
use SimpleSAML\WebServices\MetadataExchange\Constants as C;

/**
Expand All @@ -16,15 +15,15 @@
class XPath extends \SimpleSAML\XPath\XPath
{
/*
* Get a DOMXPath object that can be used to search for WS Metadata Exchange elements.
* Get a Dom\XPath object that can be used to search for WS Metadata Exchange elements.
*
* @param \DOMNode $node The document to associate to the DOMXPath object.
* @param \Dom\Node $node The document to associate to the Dom\XPath object.
* @param bool $autoregister Whether to auto-register all namespaces used in the document
*
* @return \DOMXPath A DOMXPath object ready to use in the given document, with several
* @return \Dom\XPath A Dom\XPath object ready to use in the given document, with several
* ws-related namespaces already registered.
*/
public static function getXPath(DOMNode $node, bool $autoregister = false): DOMXPath
public static function getXPath(Dom\Node $node, bool $autoregister = false): Dom\XPath
{
$xp = parent::getXPath($node, $autoregister);

Expand Down
6 changes: 3 additions & 3 deletions src/XML/wsx/GetMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\WebServices\MetadataExchange\XML\wsx;

use DOMElement;
use Dom;
use SimpleSAML\WebServices\MetadataExchange\Assert\Assert;
use SimpleSAML\XML\ExtendableAttributesTrait;
use SimpleSAML\XML\SchemaValidatableElementInterface;
Expand Down Expand Up @@ -85,7 +85,7 @@ public function isEmptyElement(): bool
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
* if the qualified name of the supplied element is wrong
*/
public static function fromXML(DOMElement $xml): static
public static function fromXML(Dom\Element $xml): static
{
Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
Expand All @@ -107,7 +107,7 @@ public static function fromXML(DOMElement $xml): static
/**
* Add this GetMetadata to an XML element.
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = parent::instantiateParentElement($parent);

Expand Down
6 changes: 3 additions & 3 deletions src/XML/wsx/Metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\WebServices\MetadataExchange\XML\wsx;

use DOMElement;
use Dom;
use SimpleSAML\WebServices\MetadataExchange\Assert\Assert;
use SimpleSAML\XML\ExtendableAttributesTrait;
use SimpleSAML\XML\ExtendableElementTrait;
Expand Down Expand Up @@ -77,7 +77,7 @@ public function isEmptyElement(): bool
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
* if the qualified name of the supplied element is wrong
*/
public static function fromXML(DOMElement $xml): static
public static function fromXML(Dom\Element $xml): static
{
Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
Expand All @@ -93,7 +93,7 @@ public static function fromXML(DOMElement $xml): static
/**
* Add this Metadata to an XML element.
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = parent::instantiateParentElement($parent);

Expand Down
6 changes: 3 additions & 3 deletions src/XML/wsx/MetadataReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\WebServices\MetadataExchange\XML\wsx;

use DOMElement;
use Dom;
use SimpleSAML\WebServices\MetadataExchange\Assert\Assert;
use SimpleSAML\XML\ExtendableElementTrait;
use SimpleSAML\XML\SchemaValidatableElementInterface;
Expand Down Expand Up @@ -47,7 +47,7 @@ final public function __construct(
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
* if the qualified name of the supplied element is wrong
*/
public static function fromXML(DOMElement $xml): static
public static function fromXML(Dom\Element $xml): static
{
Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
Expand All @@ -61,7 +61,7 @@ public static function fromXML(DOMElement $xml): static
/**
* Add this MetadataReference to an XML element.
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = parent::instantiateParentElement($parent);

Expand Down
6 changes: 3 additions & 3 deletions src/XML/wsx/MetadataSection.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\WebServices\MetadataExchange\XML\wsx;

use DOMElement;
use Dom;
use SimpleSAML\WebServices\MetadataExchange\Assert\Assert;
use SimpleSAML\XML\ExtendableAttributesTrait;
use SimpleSAML\XML\ExtendableElementTrait;
Expand Down Expand Up @@ -103,7 +103,7 @@ public function getIdentifier(): ?AnyURIValue
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
* if the qualified name of the supplied element is wrong
*/
public static function fromXML(DOMElement $xml): static
public static function fromXML(Dom\Element $xml): static
{
Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
Expand All @@ -128,7 +128,7 @@ public static function fromXML(DOMElement $xml): static
/**
* Add this MetadataSection to an XML element.
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = parent::instantiateParentElement($parent);
$e->setAttribute('Dialect', $this->getDialect()->getValue());
Expand Down
9 changes: 5 additions & 4 deletions tests/MetadataExchange/XML/wsx/DialectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ public function testMarshalling(): void
{
$dialect = Dialect::fromString(C::NAMESPACE);

$this->assertEquals(
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
strval($dialect),
);
$expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement);
$this->assertNotFalse($expectedXml);
$actualXml = strval($dialect);

$this->assertXmlStringEqualsXmlString($expectedXml, $actualXml);
}
}
9 changes: 5 additions & 4 deletions tests/MetadataExchange/XML/wsx/GetMetadataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@ public function testMarshalling(): void
[$attr1],
);

$expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement);
$this->assertNotFalse($expectedXml);
$actualXml = strval($getMetadata);

$this->assertXmlStringEqualsXmlString($expectedXml, $actualXml);
$this->assertFalse($getMetadata->isEmptyElement());
$this->assertEquals(
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
strval($getMetadata),
);
}
}
9 changes: 5 additions & 4 deletions tests/MetadataExchange/XML/wsx/IdentifierTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ public function testMarshalling(): void
{
$identifier = Identifier::fromString(C::NAMESPACE);

$this->assertEquals(
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
strval($identifier),
);
$expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement);
$this->assertNotFalse($expectedXml);
$actualXml = strval($identifier);

$this->assertXmlStringEqualsXmlString($expectedXml, $actualXml);
}
}
9 changes: 5 additions & 4 deletions tests/MetadataExchange/XML/wsx/LocationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ public function testMarshalling(): void
{
$location = Location::fromString(C::NAMESPACE);

$this->assertEquals(
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
strval($location),
);
$expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement);
$this->assertNotFalse($expectedXml);
$actualXml = strval($location);

$this->assertXmlStringEqualsXmlString($expectedXml, $actualXml);
}
}
23 changes: 12 additions & 11 deletions tests/MetadataExchange/XML/wsx/MetadataReferenceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\Test\WebServices\MetadataExchange\XML\wsx;

use DOMElement;
use Dom;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
Expand Down Expand Up @@ -37,14 +37,14 @@ final class MetadataReferenceTest extends TestCase
use SerializableElementTestTrait;


/** @var \DOMElement $referenceParametersContent */
protected static DOMElement $referenceParametersContent;
/** @var \Dom\Element $referenceParametersContent */
protected static Dom\Element $referenceParametersContent;

/** @var \DOMElement $metadataContent */
protected static DOMElement $metadataContent;
/** @var \Dom\Element $metadataContent */
protected static Dom\Element $metadataContent;

/** @var \DOMElement $customContent */
protected static DOMElement $customContent;
/** @var \Dom\Element $customContent */
protected static Dom\Element $customContent;


/**
Expand Down Expand Up @@ -86,9 +86,10 @@ public function testMarshalling(): void

$metadataReference = new MetadataReference([$endpointReference]);

$this->assertEquals(
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
strval($metadataReference),
);
$expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement);
$this->assertNotFalse($expectedXml);
$actualXml = strval($metadataReference);

$this->assertXmlStringEqualsXmlString($expectedXml, $actualXml);
}
}
9 changes: 5 additions & 4 deletions tests/MetadataExchange/XML/wsx/MetadataSectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ public function testMarshalling(): void
[$attr1],
);

$this->assertEquals(
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
strval($metadataSection),
);
$expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement);
$this->assertNotFalse($expectedXml);
$actualXml = strval($metadataSection);

$this->assertXmlStringEqualsXmlString($expectedXml, $actualXml);
}
}
9 changes: 5 additions & 4 deletions tests/MetadataExchange/XML/wsx/MetadataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,11 @@ public function testMarshalling(): void

$metadata = new Metadata([$metadataSection], [new Chunk($child->documentElement)], [$attr1]);

$this->assertEquals(
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
strval($metadata),
);
$expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement);
$this->assertNotFalse($expectedXml);
$actualXml = strval($metadata);

$this->assertXmlStringEqualsXmlString($expectedXml, $actualXml);
}


Expand Down
Loading