diff --git a/composer.json b/composer.json
index 6130b5c..c2d4f30 100644
--- a/composer.json
+++ b/composer.json
@@ -14,7 +14,7 @@
"ext-dom": "*",
"simplesamlphp/assert": "~2.0",
- "simplesamlphp/xml-common": "~2.0"
+ "simplesamlphp/xml-common": "dev-feature/dom-migration-php84"
},
"require-dev": {
"simplesamlphp/simplesamlphp-test-framework": "~1.11"
@@ -31,7 +31,7 @@
},
"extra": {
"branch-alias": {
- "dev-master": "v2.0.x-dev"
+ "dev-master": "v3.0.x-dev"
}
},
"config": {
diff --git a/src/CAS/Utils/XPath.php b/src/CAS/Utils/XPath.php
index c766c90..d6a5386 100644
--- a/src/CAS/Utils/XPath.php
+++ b/src/CAS/Utils/XPath.php
@@ -4,8 +4,7 @@
namespace SimpleSAML\CAS\Utils;
-use DOMNode;
-use DOMXPath;
+use Dom;
use SimpleSAML\CAS\Constants as C;
/**
@@ -16,21 +15,21 @@
class XPath extends \SimpleSAML\XPath\XPath
{
/**
- * Get a DOMXPath object that can be used to search for CAS elements.
+ * Get a Dom\XPath object that can be used to search for CAS 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
* cas-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);
/*
* - Registering 'cas' to the same URI again is fine.
- * - If someone previously bound 'cas' to a different URI on the same DOMXPath,
+ * - If someone previously bound 'cas' to a different URI on the same Dom\XPath,
* your call will change its meaning for subsequent queries
* */
$xp->registerNamespace('cas', C::NS_CAS);
diff --git a/src/CAS/XML/AbstractAttributes.php b/src/CAS/XML/AbstractAttributes.php
index c863240..88f2d83 100644
--- a/src/CAS/XML/AbstractAttributes.php
+++ b/src/CAS/XML/AbstractAttributes.php
@@ -4,7 +4,7 @@
namespace SimpleSAML\CAS\XML;
-use DOMElement;
+use Dom;
use SimpleSAML\CAS\Constants as C;
use SimpleSAML\XML\ExtendableElementTrait;
use SimpleSAML\XMLSchema\XML\Constants\NS;
@@ -80,10 +80,10 @@ public function getIsFromNewLogin(): IsFromNewLogin
/**
* Convert this Attributes to XML.
*
- * @param \DOMElement|null $parent The element we should append this Attributes to.
- * @return \DOMElement
+ * @param \Dom\Element|null $parent The element we should append this Attributes to.
+ * @return \Dom\Element
*/
- public function toXML(?DOMElement $parent = null): DOMElement
+ public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);
diff --git a/src/CAS/XML/AbstractAuthenticationFailure.php b/src/CAS/XML/AbstractAuthenticationFailure.php
index 4fc400f..d157565 100644
--- a/src/CAS/XML/AbstractAuthenticationFailure.php
+++ b/src/CAS/XML/AbstractAuthenticationFailure.php
@@ -4,7 +4,7 @@
namespace SimpleSAML\CAS\XML;
-use DOMElement;
+use Dom;
use SimpleSAML\CAS\Type\CodeValue;
use SimpleSAML\XML\TypedTextContentTrait;
use SimpleSAML\XMLSchema\Type\StringValue;
@@ -52,10 +52,10 @@ public function getCode(): CodeValue
/**
* Convert this AuthenticationFailure to XML.
*
- * @param \DOMElement|null $parent The element we should append to.
- * @return \DOMElement This AuthenticatioFailure-element.
+ * @param \Dom\Element|null $parent The element we should append to.
+ * @return \Dom\Element This AuthenticatioFailure-element.
*/
- public function toXML(?DOMElement $parent = null): DOMElement
+ public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);
diff --git a/src/CAS/XML/AbstractAuthenticationSuccess.php b/src/CAS/XML/AbstractAuthenticationSuccess.php
index 07e6e48..3ce3a02 100644
--- a/src/CAS/XML/AbstractAuthenticationSuccess.php
+++ b/src/CAS/XML/AbstractAuthenticationSuccess.php
@@ -4,7 +4,7 @@
namespace SimpleSAML\CAS\XML;
-use DOMElement;
+use Dom;
/**
* Class for CAS authenticationSuccess
@@ -72,10 +72,10 @@ public function getProxies(): ?Proxies
/**
* Convert this AuthenticationSuccess to XML.
*
- * @param \DOMElement|null $parent The element we should append this AuthenticationSuccess to.
- * @return \DOMElement
+ * @param \Dom\Element|null $parent The element we should append this AuthenticationSuccess to.
+ * @return \Dom\Element
*/
- public function toXML(?DOMElement $parent = null): DOMElement
+ public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);
diff --git a/src/CAS/XML/AbstractProxies.php b/src/CAS/XML/AbstractProxies.php
index 17ea9ce..137ba08 100644
--- a/src/CAS/XML/AbstractProxies.php
+++ b/src/CAS/XML/AbstractProxies.php
@@ -4,7 +4,7 @@
namespace SimpleSAML\CAS\XML;
-use DOMElement;
+use Dom;
use SimpleSAML\CAS\Assert\Assert;
use SimpleSAML\CAS\Constants as C;
use SimpleSAML\XMLSchema\Exception\MissingElementException;
@@ -45,10 +45,10 @@ public function getProxy(): array
/**
* Convert this Proxies to XML.
*
- * @param \DOMElement|null $parent The element we should append this Proxies to.
- * @return \DOMElement
+ * @param \Dom\Element|null $parent The element we should append this Proxies to.
+ * @return \Dom\Element
*/
- public function toXML(?DOMElement $parent = null): DOMElement
+ public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);
diff --git a/src/CAS/XML/AbstractProxyFailure.php b/src/CAS/XML/AbstractProxyFailure.php
index 3de8024..9fd7d71 100644
--- a/src/CAS/XML/AbstractProxyFailure.php
+++ b/src/CAS/XML/AbstractProxyFailure.php
@@ -4,7 +4,7 @@
namespace SimpleSAML\CAS\XML;
-use DOMElement;
+use Dom;
use SimpleSAML\CAS\Type\CodeValue;
use SimpleSAML\XML\TypedTextContentTrait;
use SimpleSAML\XMLSchema\Type\StringValue;
@@ -52,10 +52,10 @@ public function getCode(): CodeValue
/**
* Convert this ProxyFailure to XML.
*
- * @param \DOMElement|null $parent The element we should append to.
- * @return \DOMElement This ProxyFailure-element.
+ * @param \Dom\Element|null $parent The element we should append to.
+ * @return \Dom\Element This ProxyFailure-element.
*/
- public function toXML(?DOMElement $parent = null): DOMElement
+ public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);
diff --git a/src/CAS/XML/AbstractProxySuccess.php b/src/CAS/XML/AbstractProxySuccess.php
index 57de651..7d3db67 100644
--- a/src/CAS/XML/AbstractProxySuccess.php
+++ b/src/CAS/XML/AbstractProxySuccess.php
@@ -4,7 +4,7 @@
namespace SimpleSAML\CAS\XML;
-use DOMElement;
+use Dom;
/**
* Class for CAS proxySuccess
@@ -39,10 +39,10 @@ public function getProxyTicket(): ProxyTicket
/**
* Convert this ProxySuccess to XML.
*
- * @param \DOMElement|null $parent The element we should append to.
- * @return \DOMElement This ProxySuccess-element.
+ * @param \Dom\Element|null $parent The element we should append to.
+ * @return \Dom\Element This ProxySuccess-element.
*/
- public function toXML(?DOMElement $parent = null): DOMElement
+ public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);
diff --git a/src/CAS/XML/AbstractServiceResponse.php b/src/CAS/XML/AbstractServiceResponse.php
index b85e96e..49ec40a 100644
--- a/src/CAS/XML/AbstractServiceResponse.php
+++ b/src/CAS/XML/AbstractServiceResponse.php
@@ -4,7 +4,7 @@
namespace SimpleSAML\CAS\XML;
-use DOMElement;
+use Dom;
/**
* Class for CAS serviceResponse
@@ -39,10 +39,10 @@ public function getResponse(): AbstractResponse
/**
* Convert this ServiceResponse to XML.
*
- * @param \DOMElement|null $parent The element we should append this ServiceResponse to.
- * @return \DOMElement
+ * @param \Dom\Element|null $parent The element we should append this ServiceResponse to.
+ * @return \Dom\Element
*/
- public function toXML(?DOMElement $parent = null): DOMElement
+ public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);
diff --git a/src/CAS/XML/Attributes.php b/src/CAS/XML/Attributes.php
index 28b95fa..980f59f 100644
--- a/src/CAS/XML/Attributes.php
+++ b/src/CAS/XML/Attributes.php
@@ -4,7 +4,7 @@
namespace SimpleSAML\CAS\XML;
-use DOMElement;
+use Dom;
use SimpleSAML\CAS\Assert\Assert;
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
use SimpleSAML\XMLSchema\Exception\MissingElementException;
@@ -19,7 +19,7 @@ final class Attributes extends AbstractAttributes
/**
* Convert XML into a cas:attributes-element
*
- * @param \DOMElement $xml The XML element we should load
+ * @param \Dom\Element $xml The XML element we should load
* @return static
*
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
@@ -27,7 +27,7 @@ final class Attributes extends AbstractAttributes
* @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException
* if the supplied element is missing one of the mandatory attributes
*/
- 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::getNamespaceURI(), InvalidDOMElementException::class);
diff --git a/src/CAS/XML/AuthenticationDate.php b/src/CAS/XML/AuthenticationDate.php
index b2e2e3c..28ef0d9 100644
--- a/src/CAS/XML/AuthenticationDate.php
+++ b/src/CAS/XML/AuthenticationDate.php
@@ -4,7 +4,7 @@
namespace SimpleSAML\CAS\XML;
-use DOMElement;
+use Dom;
use SimpleSAML\CAS\Assert\Assert;
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
use SimpleSAML\XMLSchema\Type\DateTimeValue;
@@ -44,9 +44,9 @@ public function getTimestamp(): DateTimeValue
/**
* Convert this element into an XML document.
*
- * @return \DOMElement The root element of the DOM tree
+ * @return \Dom\Element The root element of the DOM tree
*/
- public function toXML(?DOMElement $parent = null): DOMElement
+ public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);
$e->textContent = strval($this->getTimestamp());
@@ -58,17 +58,17 @@ public function toXML(?DOMElement $parent = null): DOMElement
/**
* Convert XML into a cas:authenticationDate
*
- * @param \DOMElement $xml The XML element we should load
+ * @param \Dom\Element $xml The XML element we should load
* @return static
*
* @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::getNamespaceURI(), InvalidDOMElementException::class);
- return new static(DateTimeValue::fromString($xml->textContent));
+ return new static(DateTimeValue::fromString((string) $xml->textContent));
}
}
diff --git a/src/CAS/XML/AuthenticationFailure.php b/src/CAS/XML/AuthenticationFailure.php
index 6492dd2..e703ef9 100644
--- a/src/CAS/XML/AuthenticationFailure.php
+++ b/src/CAS/XML/AuthenticationFailure.php
@@ -4,7 +4,7 @@
namespace SimpleSAML\CAS\XML;
-use DOMElement;
+use Dom;
use SimpleSAML\CAS\Assert\Assert;
use SimpleSAML\CAS\Type\CodeValue;
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
@@ -20,7 +20,7 @@ final class AuthenticationFailure extends AbstractAuthenticationFailure
/**
* Initialize an AuthenticationFailure element.
*
- * @param \DOMElement $xml The XML element we should load.
+ * @param \Dom\Element $xml The XML element we should load.
* @return static
*
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
@@ -28,13 +28,13 @@ final class AuthenticationFailure extends AbstractAuthenticationFailure
* @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException
* if the supplied element is missing any of the mandatory attributes
*/
- 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::getNamespaceURI(), InvalidDOMElementException::class);
return new static(
- StringValue::fromString($xml->textContent),
+ StringValue::fromString((string) $xml->textContent),
self::getAttribute($xml, 'code', CodeValue::class),
);
}
diff --git a/src/CAS/XML/AuthenticationSuccess.php b/src/CAS/XML/AuthenticationSuccess.php
index 7816041..6f0faea 100644
--- a/src/CAS/XML/AuthenticationSuccess.php
+++ b/src/CAS/XML/AuthenticationSuccess.php
@@ -4,7 +4,7 @@
namespace SimpleSAML\CAS\XML;
-use DOMElement;
+use Dom;
use SimpleSAML\CAS\Assert\Assert;
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
use SimpleSAML\XMLSchema\Exception\MissingElementException;
@@ -21,7 +21,7 @@ final class AuthenticationSuccess extends AbstractAuthenticationSuccess
/**
* Convert XML into a cas:authenticationSuccess-element
*
- * @param \DOMElement $xml The XML element we should load
+ * @param \Dom\Element $xml The XML element we should load
* @return static
*
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
@@ -29,7 +29,7 @@ final class AuthenticationSuccess extends AbstractAuthenticationSuccess
* @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException
* if the supplied element is missing one of the mandatory attributes
*/
- 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::getNamespaceURI(), InvalidDOMElementException::class);
diff --git a/src/CAS/XML/Proxies.php b/src/CAS/XML/Proxies.php
index c3a0e53..d10588f 100644
--- a/src/CAS/XML/Proxies.php
+++ b/src/CAS/XML/Proxies.php
@@ -4,7 +4,7 @@
namespace SimpleSAML\CAS\XML;
-use DOMElement;
+use Dom;
use SimpleSAML\CAS\Assert\Assert;
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
@@ -18,13 +18,13 @@ final class Proxies extends AbstractProxies
/**
* Convert XML into a Proxies-element
*
- * @param \DOMElement $xml The XML element we should load
+ * @param \Dom\Element $xml The XML element we should load
* @return static
*
* @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::getNamespaceURI(), InvalidDOMElementException::class);
diff --git a/src/CAS/XML/ProxyFailure.php b/src/CAS/XML/ProxyFailure.php
index a9a50e1..6ad35d9 100644
--- a/src/CAS/XML/ProxyFailure.php
+++ b/src/CAS/XML/ProxyFailure.php
@@ -4,7 +4,7 @@
namespace SimpleSAML\CAS\XML;
-use DOMElement;
+use Dom;
use SimpleSAML\CAS\Assert\Assert;
use SimpleSAML\CAS\Type\CodeValue;
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
@@ -20,7 +20,7 @@ final class ProxyFailure extends AbstractProxyFailure
/**
* Initialize an ProxyFailure element.
*
- * @param \DOMElement $xml The XML element we should load.
+ * @param \Dom\Element $xml The XML element we should load.
* @return static
*
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
@@ -28,13 +28,13 @@ final class ProxyFailure extends AbstractProxyFailure
* @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException
* if the supplied element is missing any of the mandatory attributes
*/
- 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::getNamespaceURI(), InvalidDOMElementException::class);
return new static(
- StringValue::fromString($xml->textContent),
+ StringValue::fromString((string) $xml->textContent),
self::getAttribute($xml, 'code', CodeValue::class),
);
}
diff --git a/src/CAS/XML/ProxySuccess.php b/src/CAS/XML/ProxySuccess.php
index 41f2c29..f1e8a32 100644
--- a/src/CAS/XML/ProxySuccess.php
+++ b/src/CAS/XML/ProxySuccess.php
@@ -4,7 +4,7 @@
namespace SimpleSAML\CAS\XML;
-use DOMElement;
+use Dom;
use SimpleSAML\CAS\Assert\Assert;
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
use SimpleSAML\XMLSchema\Exception\MissingElementException;
@@ -19,7 +19,7 @@ final class ProxySuccess extends AbstractProxySuccess
/**
* Initialize an ProxySuccess element.
*
- * @param \DOMElement $xml The XML element we should load.
+ * @param \Dom\Element $xml The XML element we should load.
* @return static
*
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
@@ -27,7 +27,7 @@ final class ProxySuccess extends AbstractProxySuccess
* @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException
* if the supplied element is missing any of the mandatory attributes
*/
- 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::getNamespaceURI(), InvalidDOMElementException::class);
diff --git a/src/CAS/XML/ServiceResponse.php b/src/CAS/XML/ServiceResponse.php
index e16a562..0b9956b 100644
--- a/src/CAS/XML/ServiceResponse.php
+++ b/src/CAS/XML/ServiceResponse.php
@@ -4,7 +4,7 @@
namespace SimpleSAML\CAS\XML;
-use DOMElement;
+use Dom;
use SimpleSAML\CAS\Assert\Assert;
use SimpleSAML\XML\SchemaValidatableElementInterface;
use SimpleSAML\XML\SchemaValidatableElementTrait;
@@ -27,7 +27,7 @@ final class ServiceResponse extends AbstractServiceResponse implements SchemaVal
/**
* Convert XML into a cas:serviceResponse-element
*
- * @param \DOMElement $xml The XML element we should load
+ * @param \Dom\Element $xml The XML element we should load
* @return static
*
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
@@ -35,7 +35,7 @@ final class ServiceResponse extends AbstractServiceResponse implements SchemaVal
* @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException
* if the supplied element is missing one of the mandatory attributes
*/
- 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::getNamespaceURI(), InvalidDOMElementException::class);
diff --git a/tests/CAS/XML/AttributesTest.php b/tests/CAS/XML/AttributesTest.php
index 5522238..795c244 100644
--- a/tests/CAS/XML/AttributesTest.php
+++ b/tests/CAS/XML/AttributesTest.php
@@ -65,7 +65,7 @@ public function testMarshalling(): void
'myValue',
);
- /** @var \DOMElement $elt */
+ /** @var \Dom\Element $elt */
$elt = $document->documentElement;
$myAttribute = new Chunk($elt);
@@ -73,7 +73,7 @@ public function testMarshalling(): void
'myOtherValue',
);
- /** @var \DOMElement $elt */
+ /** @var \Dom\Element $elt */
$elt = $document->documentElement;
$myOtherAttribute = new Chunk($elt);
@@ -84,10 +84,11 @@ public function testMarshalling(): void
[$myAttribute, $myOtherAttribute],
);
- $this->assertEquals(
- self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
- strval($attributes),
- );
+ $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement);
+ $this->assertNotFalse($expectedXml);
+ $actualXml = strval($attributes);
+
+ $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml);
}
@@ -100,7 +101,7 @@ public function testMarshallingElementOrdering(): void
'myValue',
);
- /** @var \DOMElement $elt */
+ /** @var \Dom\Element $elt */
$elt = $document->documentElement;
$myAttribute = new Chunk($elt);
$attributes = new Attributes($authenticationDate, $longTerm, $isFromNewLogin, [$myAttribute]);
@@ -113,7 +114,7 @@ public function testMarshallingElementOrdering(): void
$this->assertCount(1, $attributesElements);
// Test ordering of cas:attributes contents
- /** @var \DOMElement[] $attributesElements */
+ /** @var \Dom\Element[] $attributesElements */
$attributesElements = XPath::xpQuery(
$attributesElement,
'./cas:authenticationDate/following-sibling::*',
diff --git a/tests/CAS/XML/AuthenticationDateTest.php b/tests/CAS/XML/AuthenticationDateTest.php
index 481edc6..236a95e 100644
--- a/tests/CAS/XML/AuthenticationDateTest.php
+++ b/tests/CAS/XML/AuthenticationDateTest.php
@@ -51,9 +51,10 @@ public function testMarshalling(): void
{
$authenticationDate = new AuthenticationDate(self::$authenticationDate);
- $this->assertEquals(
- self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
- strval($authenticationDate),
- );
+ $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement);
+ $this->assertNotFalse($expectedXml);
+ $actualXml = strval($authenticationDate);
+
+ $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml);
}
}
diff --git a/tests/CAS/XML/AuthenticationFailureTest.php b/tests/CAS/XML/AuthenticationFailureTest.php
index fb56061..bfbd5a8 100644
--- a/tests/CAS/XML/AuthenticationFailureTest.php
+++ b/tests/CAS/XML/AuthenticationFailureTest.php
@@ -54,9 +54,10 @@ public function testMarshalling(): void
CodeValue::fromEnum(ErrorEnum::INVALID_TICKET),
);
- $this->assertEquals(
- self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
- strval($authenticationFailure),
- );
+ $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement);
+ $this->assertNotFalse($expectedXml);
+ $actualXml = strval($authenticationFailure);
+
+ $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml);
}
}
diff --git a/tests/CAS/XML/AuthenticationSuccessTest.php b/tests/CAS/XML/AuthenticationSuccessTest.php
index f189201..452b4d5 100644
--- a/tests/CAS/XML/AuthenticationSuccessTest.php
+++ b/tests/CAS/XML/AuthenticationSuccessTest.php
@@ -64,20 +64,20 @@ public static function setUpBeforeClass(): void
*/
public function testMarshalling(): void
{
- /** @var \DOMElement $firstNameElt */
+ /** @var \Dom\Element $firstNameElt */
$firstNameElt = DOMDocumentFactory::fromString(
'John',
)->documentElement;
$firstName = new Chunk($firstNameElt);
- /** @var \DOMElement $lastNameElt */
+ /** @var \Dom\Element $lastNameElt */
$lastNameElt = DOMDocumentFactory::fromString(
'Doe',
)->documentElement;
$lastName = new Chunk($lastNameElt);
- /** @var \DOMElement $emailElt */
+ /** @var \Dom\Element $emailElt */
$emailElt = DOMDocumentFactory::fromString(
'jdoe@example.org',
)->documentElement;
@@ -97,29 +97,30 @@ public function testMarshalling(): void
$authenticationSuccess = new AuthenticationSuccess($user, $attributes, $proxyGrantingTicket, $proxies);
- $this->assertEquals(
- self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
- strval($authenticationSuccess),
- );
+ $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement);
+ $this->assertNotFalse($expectedXml);
+ $actualXml = strval($authenticationSuccess);
+
+ $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml);
}
public function testMarshallingElementOrdering(): void
{
- /** @var \DOMElement $firstNameElt */
+ /** @var \Dom\Element $firstNameElt */
$firstNameElt = DOMDocumentFactory::fromString(
'John',
)->documentElement;
$firstName = new Chunk($firstNameElt);
- /** @var \DOMElement $lastNameElt */
+ /** @var \Dom\Element $lastNameElt */
$lastNameElt = DOMDocumentFactory::fromString(
'Doe',
)->documentElement;
$lastName = new Chunk($lastNameElt);
- /** @var \DOMElement $emailElt */
+ /** @var \Dom\Element $emailElt */
$emailElt = DOMDocumentFactory::fromString(
'jdoe@example.org',
)->documentElement;
@@ -146,7 +147,7 @@ public function testMarshallingElementOrdering(): void
$this->assertCount(1, $authenticationSuccessElements);
// Test ordering of cas:authenticationSuccess contents
- /** @var \DOMElement[] $authenticationSuccessElements */
+ /** @var \Dom\Element[] $authenticationSuccessElements */
$authenticationSuccessElements = XPath::xpQuery(
$authenticationSuccessElement,
'./cas:user/following-sibling::*',
diff --git a/tests/CAS/XML/IsFromNewLoginTest.php b/tests/CAS/XML/IsFromNewLoginTest.php
index 829fa66..e27f83a 100644
--- a/tests/CAS/XML/IsFromNewLoginTest.php
+++ b/tests/CAS/XML/IsFromNewLoginTest.php
@@ -44,9 +44,10 @@ public function testMarshalling(): void
{
$isFromNewLogin = IsFromNewLogin::fromString('true');
- $this->assertEquals(
- self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
- strval($isFromNewLogin),
- );
+ $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement);
+ $this->assertNotFalse($expectedXml);
+ $actualXml = strval($isFromNewLogin);
+
+ $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml);
}
}
diff --git a/tests/CAS/XML/LongTermAuthenticationRequestTokenUsedTest.php b/tests/CAS/XML/LongTermAuthenticationRequestTokenUsedTest.php
index d74d427..f60c0b3 100644
--- a/tests/CAS/XML/LongTermAuthenticationRequestTokenUsedTest.php
+++ b/tests/CAS/XML/LongTermAuthenticationRequestTokenUsedTest.php
@@ -44,9 +44,10 @@ public function testMarshalling(): void
{
$longTerm = LongTermAuthenticationRequestTokenUsed::fromString('true');
- $this->assertEquals(
- self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
- strval($longTerm),
- );
+ $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement);
+ $this->assertNotFalse($expectedXml);
+ $actualXml = strval($longTerm);
+
+ $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml);
}
}
diff --git a/tests/CAS/XML/ProxiesTest.php b/tests/CAS/XML/ProxiesTest.php
index 48110db..bbbd81f 100644
--- a/tests/CAS/XML/ProxiesTest.php
+++ b/tests/CAS/XML/ProxiesTest.php
@@ -49,9 +49,10 @@ public function testMarshalling(): void
$entry2 = Proxy::fromString('https://example.org/proxy/2');
$list = new Proxies([$entry1, $entry2]);
- $this->assertEquals(
- self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
- strval($list),
- );
+ $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement);
+ $this->assertNotFalse($expectedXml);
+ $actualXml = strval($list);
+
+ $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml);
}
}
diff --git a/tests/CAS/XML/ProxyFailureTest.php b/tests/CAS/XML/ProxyFailureTest.php
index 6184bf6..841395c 100644
--- a/tests/CAS/XML/ProxyFailureTest.php
+++ b/tests/CAS/XML/ProxyFailureTest.php
@@ -54,9 +54,10 @@ public function testMarshalling(): void
CodeValue::fromEnum(ErrorEnum::INVALID_REQUEST),
);
- $this->assertEquals(
- self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
- strval($proxyFailure),
- );
+ $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement);
+ $this->assertNotFalse($expectedXml);
+ $actualXml = strval($proxyFailure);
+
+ $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml);
}
}
diff --git a/tests/CAS/XML/ProxyGrantingTicketTest.php b/tests/CAS/XML/ProxyGrantingTicketTest.php
index f39c5b0..99dda93 100644
--- a/tests/CAS/XML/ProxyGrantingTicketTest.php
+++ b/tests/CAS/XML/ProxyGrantingTicketTest.php
@@ -44,9 +44,10 @@ public function testMarshalling(): void
{
$proxyGrantingTicket = ProxyGrantingTicket::fromString('PGTIOU-84678-8a9d...');
- $this->assertEquals(
- self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
- strval($proxyGrantingTicket),
- );
+ $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement);
+ $this->assertNotFalse($expectedXml);
+ $actualXml = strval($proxyGrantingTicket);
+
+ $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml);
}
}
diff --git a/tests/CAS/XML/ProxySuccessTest.php b/tests/CAS/XML/ProxySuccessTest.php
index 33e12a5..a23ca6d 100644
--- a/tests/CAS/XML/ProxySuccessTest.php
+++ b/tests/CAS/XML/ProxySuccessTest.php
@@ -51,9 +51,10 @@ public function testMarshalling(): void
ProxyTicket::fromString('PT-1856392-b98xZrQN4p90ASrw96c8'),
);
- $this->assertEquals(
- self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
- strval($proxySuccess),
- );
+ $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement);
+ $this->assertNotFalse($expectedXml);
+ $actualXml = strval($proxySuccess);
+
+ $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml);
}
}
diff --git a/tests/CAS/XML/ProxyTest.php b/tests/CAS/XML/ProxyTest.php
index c7826b8..4d5b052 100644
--- a/tests/CAS/XML/ProxyTest.php
+++ b/tests/CAS/XML/ProxyTest.php
@@ -44,9 +44,10 @@ public function testMarshalling(): void
{
$proxy = Proxy::fromString('https://example.org/proxy');
- $this->assertEquals(
- self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
- strval($proxy),
- );
+ $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement);
+ $this->assertNotFalse($expectedXml);
+ $actualXml = strval($proxy);
+
+ $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml);
}
}
diff --git a/tests/CAS/XML/ProxyTicketTest.php b/tests/CAS/XML/ProxyTicketTest.php
index f3c973b..f9935e7 100644
--- a/tests/CAS/XML/ProxyTicketTest.php
+++ b/tests/CAS/XML/ProxyTicketTest.php
@@ -44,9 +44,10 @@ public function testMarshalling(): void
{
$proxyTicket = ProxyTicket::fromString('PT-1856392-b98xZrQN4p90ASrw96c8');
- $this->assertEquals(
- self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
- strval($proxyTicket),
- );
+ $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement);
+ $this->assertNotFalse($expectedXml);
+ $actualXml = strval($proxyTicket);
+
+ $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml);
}
}
diff --git a/tests/CAS/XML/ServiceResponseTest.php b/tests/CAS/XML/ServiceResponseTest.php
index ab65378..d96d38c 100644
--- a/tests/CAS/XML/ServiceResponseTest.php
+++ b/tests/CAS/XML/ServiceResponseTest.php
@@ -71,7 +71,7 @@ public function testMarshalling(): void
$longTerm = LongTermAuthenticationRequestTokenUsed::fromString('true');
$isFromNewLogin = IsFromNewLogin::fromString('true');
- /** @var \DOMElement $element */
+ /** @var \Dom\Element $element */
$element = DOMDocumentFactory::fromString(
'myValue',
)->documentElement;
@@ -84,9 +84,10 @@ public function testMarshalling(): void
);
$serviceResponse = new ServiceResponse($authenticationSuccess);
- $this->assertEquals(
- self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
- strval($serviceResponse),
- );
+ $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement);
+ $this->assertNotFalse($expectedXml);
+ $actualXml = strval($serviceResponse);
+
+ $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml);
}
}
diff --git a/tests/CAS/XML/UserTest.php b/tests/CAS/XML/UserTest.php
index a72dd81..2891f23 100644
--- a/tests/CAS/XML/UserTest.php
+++ b/tests/CAS/XML/UserTest.php
@@ -44,9 +44,10 @@ public function testMarshalling(): void
{
$user = User::fromString('username');
- $this->assertEquals(
- self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
- strval($user),
- );
+ $expectedXml = self::$xmlRepresentation->saveXml(self::$xmlRepresentation->documentElement);
+ $this->assertNotFalse($expectedXml);
+ $actualXml = strval($user);
+
+ $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml);
}
}