diff --git a/ChangeLog.md b/ChangeLog.md index cc3f1472..149bd7a8 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -3,6 +3,12 @@ XML APIs for the XP Framework ChangeLog ## ?.?.? / ????-??-?? +## 11.0.0 / 2021-10-21 + +* Made compatible with XP 11 - @thekid +* Implemented xp-framework/rfc#341, dropping compatibility with XP 9 + (@thekid) + ## 10.0.0 / 2020-04-10 * Implemented xp-framework/rfc#334: Drop PHP 5.6: diff --git a/composer.json b/composer.json index b88d8c1e..a32c3e41 100755 --- a/composer.json +++ b/composer.json @@ -6,12 +6,12 @@ "description" : "XML APIs for the XP Framework", "keywords": ["module", "xp"], "require" : { - "xp-framework/core": "^10.0 | ^9.0 | ^8.0 | ^7.0", - "xp-framework/collections": "^9.0 | ^8.0 | ^7.0", + "xp-framework/core": "^11.0 | ^10.0", + "xp-framework/collections": "^10.0 | ^9.0 | ^8.0", "php" : ">=7.0.0" }, "require-dev" : { - "xp-framework/unittest": "^11.0 | ^10.0 | ^9.0 | ^8.0 | ^7.0" + "xp-framework/unittest": "^11.0 | ^10.0" }, "autoload" : { "files" : ["src/main/php/autoload.php"] diff --git a/src/main/php/xml/Node.class.php b/src/main/php/xml/Node.class.php index b3a77392..73be6da0 100755 --- a/src/main/php/xml/Node.class.php +++ b/src/main/php/xml/Node.class.php @@ -300,7 +300,7 @@ public function getSource($indent= INDENT_WRAPPED, $encoding= \xp::ENCODING, $in } // No content and no children => close tag - if (0 == strlen($content)) { + if (null === $content || 0 === strlen($content)) { if (!$this->children) return $xml."/>\n"; $xml.= '>'; } else { diff --git a/src/main/php/xml/xslt/XSLDateCallback.class.php b/src/main/php/xml/xslt/XSLDateCallback.class.php index 4224a951..a08f27c2 100755 --- a/src/main/php/xml/xslt/XSLDateCallback.class.php +++ b/src/main/php/xml/xslt/XSLDateCallback.class.php @@ -2,6 +2,7 @@ use lang\{Enum, XPClass}; use util\{Date, DateMath, TimeInterval, TimeZone}; +use xml\Xslmethod; /** * XSL callbacks for Date operations @@ -22,7 +23,7 @@ class XSLDateCallback { * @param string timezone default NULL * @return string */ - #[@xslmethod] + #[Xslmethod] public function format($date, $format, $timezone= null) { $timezone= empty($timezone) ? null : $timezone; return (new Date($date))->toString($format, new TimeZone($timezone)); @@ -36,7 +37,7 @@ public function format($date, $format, $timezone= null) { * @param string strdate2 * @return int */ - #[@xslmethod] + #[Xslmethod] public function diff($type, $strdate1, $strdate2) { return DateMath::diff( Enum::valueOf(XPClass::forName('util.TimeInterval'), strtoupper($type)), diff --git a/src/main/php/xml/xslt/XSLStringCallback.class.php b/src/main/php/xml/xslt/XSLStringCallback.class.php index 294d9e0c..d8a06b8e 100755 --- a/src/main/php/xml/xslt/XSLStringCallback.class.php +++ b/src/main/php/xml/xslt/XSLStringCallback.class.php @@ -1,5 +1,7 @@ processor->run(); $this->assertEquals('document', $this->processor->output()); } - - #[Test] - public function loadXSLFromStreamWrapper() { - $this->processor->setXSLFile('res://xml/unittest/include.xsl'); - } - - #[Test, Expect(FileNotFoundException::class)] - public function loadNonexistantXSLFromStreamWrapper() { - $this->processor->setXSLFile('res://nonexistant.xsl'); - } } \ No newline at end of file diff --git a/src/test/php/xml/unittest/XslCallbackTest.class.php b/src/test/php/xml/unittest/XslCallbackTest.class.php index 9a117dda..1bf33e75 100755 --- a/src/test/php/xml/unittest/XslCallbackTest.class.php +++ b/src/test/php/xml/unittest/XslCallbackTest.class.php @@ -164,7 +164,7 @@ public function dateFormatCallbackWithTZ() { $this->assertEquals($date->toString('Y-m-d H:i:s T', $tz), $this->runTransformation( Node::fromObject($date, 'date')->getSource(), 'xp.date::format', - ['string(/date/value)', "'Y-m-d H:i:s T'", "'".$tz->getName()."'"] + ['string(/date/value)', "'Y-m-d H:i:s T'", "'".$tz->name()."'"] )); } diff --git a/src/test/php/xml/unittest/io/XmlStreamWriterTest.class.php b/src/test/php/xml/unittest/io/XmlStreamWriterTest.class.php index a25fa36b..13c952c8 100755 --- a/src/test/php/xml/unittest/io/XmlStreamWriterTest.class.php +++ b/src/test/php/xml/unittest/io/XmlStreamWriterTest.class.php @@ -20,7 +20,7 @@ public function startIso88591Document() { $this->writer->startDocument('1.0', 'iso-8859-1'); $this->assertEquals( '', - $this->out->getBytes() + $this->out->bytes() ); } @@ -29,7 +29,7 @@ public function startUtf8Document() { $this->writer->startDocument('1.0', 'utf-8'); $this->assertEquals( '', - $this->out->getBytes() + $this->out->bytes() ); } @@ -38,7 +38,7 @@ public function standaloneDocument() { $this->writer->startDocument('1.0', 'iso-8859-1', true); $this->assertEquals( '', - $this->out->getBytes() + $this->out->bytes() ); } @@ -47,7 +47,7 @@ public function startElement() { $this->writer->startElement('book'); $this->assertEquals( '', - $this->out->getBytes() + $this->out->bytes() ); } @@ -56,7 +56,7 @@ public function startElementWithAttribute() { $this->writer->startElement('book', ['isbn' => '978-3-86680-192-9']); $this->assertEquals( '', - $this->out->getBytes() + $this->out->bytes() ); } @@ -65,7 +65,7 @@ public function startElementWithAttributes() { $this->writer->startElement('book', ['isbn' => '978-3-86680-192-9', 'authors' => 'Timm & Alex']); $this->assertEquals( '', - $this->out->getBytes() + $this->out->bytes() ); } @@ -75,7 +75,7 @@ public function closeElement() { $this->writer->closeElement(); $this->assertEquals( '', - $this->out->getBytes() + $this->out->bytes() ); } @@ -87,7 +87,7 @@ public function closeElements() { $this->writer->closeElement(); $this->assertEquals( '', - $this->out->getBytes() + $this->out->bytes() ); } @@ -96,7 +96,7 @@ public function startComment() { $this->writer->startComment(); $this->assertEquals( '', - $this->out->getBytes() + $this->out->bytes() ); } @@ -115,7 +115,7 @@ public function startCData() { $this->writer->startCData(); $this->assertEquals( 'out->getBytes() + $this->out->bytes() ); } @@ -125,7 +125,7 @@ public function closeCData() { $this->writer->closeCData(); $this->assertEquals( '', - $this->out->getBytes() + $this->out->bytes() ); } @@ -134,7 +134,7 @@ public function startPI() { $this->writer->startPI('php'); $this->assertEquals( 'out->getBytes() + $this->out->bytes() ); } @@ -144,7 +144,7 @@ public function closePI() { $this->writer->closePI(); $this->assertEquals( '', - $this->out->getBytes() + $this->out->bytes() ); } @@ -155,7 +155,7 @@ public function writeText() { $this->writer->closeElement(); $this->assertEquals( 'Hello & World', - $this->out->getBytes() + $this->out->bytes() ); } @@ -166,7 +166,7 @@ public function writeCData() { $this->writer->closeElement(); $this->assertEquals( '', - $this->out->getBytes() + $this->out->bytes() ); } @@ -177,7 +177,7 @@ public function writeComment() { $this->writer->closeElement(); $this->assertEquals( '', - $this->out->getBytes() + $this->out->bytes() ); } @@ -190,7 +190,7 @@ public function writeCommentedNode() { $this->writer->closeElement(); $this->assertEquals( '', - $this->out->getBytes() + $this->out->bytes() ); } @@ -203,7 +203,7 @@ public function writeMarkup() { $this->writer->closeElement(); $this->assertEquals( 'This is really important!', - $this->out->getBytes() + $this->out->bytes() ); } @@ -214,7 +214,7 @@ public function writePI() { $this->writer->closeElement(); $this->assertEquals( '', - $this->out->getBytes() + $this->out->bytes() ); } @@ -223,7 +223,7 @@ public function writePIWithAttributes() { $this->writer->writePI('xml-stylesheet', ['href' => 'template.xsl']); $this->assertEquals( '', - $this->out->getBytes() + $this->out->bytes() ); } @@ -236,7 +236,7 @@ public function writeCDataAndText() { $this->writer->closeElement(); $this->assertEquals( 'HelloWorld', - $this->out->getBytes() + $this->out->bytes() ); } @@ -245,7 +245,7 @@ public function writElement() { $this->writer->writeElement('book', 'Hello & World', ['isbn' => '978-3-86680-192-9']); $this->assertEquals( 'Hello & World', - $this->out->getBytes() + $this->out->bytes() ); } @@ -254,7 +254,7 @@ public function writElementEmptyContent() { $this->writer->writeElement('book'); $this->assertEquals( '', - $this->out->getBytes() + $this->out->bytes() ); } @@ -267,7 +267,7 @@ public function endDocumentClosesAllElements() { $this->writer->closeDocument(); $this->assertEquals( '', - $this->out->getBytes() + $this->out->bytes() ); } @@ -280,7 +280,7 @@ public function endDocumentClosesComments() { $this->writer->closeDocument(); $this->assertEquals( '', - $this->out->getBytes() + $this->out->bytes() ); }