Skip to content

Commit

Permalink
tweak: php 8.4 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
g105b committed Jan 2, 2025
1 parent 6826fec commit d2b4bb8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 7 additions & 1 deletion test/phpunit/NodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ public function testCanNotConstruct():void {
public function testBaseURIClientSideOnly():void {
$document = new XMLDocument();
$sut = $document->createElement("example");
self::assertNull($sut->baseURI);

if(version_compare(PHP_VERSION, "8.4", ">=")) {
self::assertEquals(getcwd() . "/", $sut->baseURI);
}
else {
self::assertNull($sut->baseURI);
}
}

public function testChildNodesEmpty():void {
Expand Down
7 changes: 6 additions & 1 deletion test/phpunit/XMLDocumentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ public function testBodyNullOnXML():void {

public function testToStringEmptyXML():void {
$sut = new XMLDocument();
self::assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<xml/>\n", (string)$sut);
if(version_compare(PHP_VERSION, "8.4", ">=")) {
self::assertEquals("<?xml version=\"1.0\"?>\n<xml/>\n", (string)$sut);
}
else {
self::assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<xml/>\n", (string)$sut);
}
}

public function testPropContentTypeEmpty():void {
Expand Down

0 comments on commit d2b4bb8

Please sign in to comment.