diff --git a/src/main/php/xml/io/XmlStreamWriter.class.php b/src/main/php/xml/io/XmlStreamWriter.class.php
index 0a6d5bea..745aa7ca 100755
--- a/src/main/php/xml/io/XmlStreamWriter.class.php
+++ b/src/main/php/xml/io/XmlStreamWriter.class.php
@@ -2,11 +2,10 @@
use io\streams\OutputStream;
-
/**
* Outputs XML to an output stream.
*
- * @test xp://xml.unittest.io.XmlStreamWriterTest
+ * @test xml.unittest.io.XmlStreamWriterTest
*/
class XmlStreamWriter extends XmlWriter {
protected $stack= [];
@@ -21,6 +20,9 @@ public function __construct(OutputStream $stream) {
$this->stream= $stream;
}
+ /** @return io.streams.OutputStream */
+ public function out() { return $this->stream; }
+
/**
* Start writing a document
*
diff --git a/src/test/php/xml/unittest/AbstractProcessorTest.class.php b/src/test/php/xml/unittest/AbstractProcessorTest.class.php
index 77ce60c1..12a69756 100755
--- a/src/test/php/xml/unittest/AbstractProcessorTest.class.php
+++ b/src/test/php/xml/unittest/AbstractProcessorTest.class.php
@@ -2,15 +2,10 @@
use io\FileNotFoundException;
use lang\Runtime;
-use unittest\{Expect, PrerequisitesNotMetError, Test, TestCase};
+use unittest\{Assert, Expect, PrerequisitesNotMetError, Test, TestCase};
use xml\{TransformerException, Tree};
-/**
- * Test XSL processor
- *
- * @see xp://xml.IXSLProcessor
- */
-abstract class AbstractProcessorTest extends TestCase {
+abstract class AbstractProcessorTest {
public $processor= null;
public $xmlDeclaration= '';
@@ -24,7 +19,7 @@ abstract class AbstractProcessorTest extends TestCase {
* @throws unittest.AssertionFailedError
*/
public function assertXmlEquals($expect, $actual) {
- $this->assertEquals(
+ Assert::equals(
$this->xmlDeclaration.preg_replace('#>[\s\r\n]+<#', '><', trim($expect)),
preg_replace('#>[\s\r\n]+<#', '><', trim($actual))
);
@@ -82,6 +77,7 @@ public function processorCharset() { }
*
* @throws unittest.PrerequisitesNotMetError
*/
+ #[Before]
public function setUp() {
foreach ((array)$this->neededExtension() as $ext) {
if (!extension_loaded($ext)) {
@@ -167,7 +163,7 @@ public function setMalformedXSLTree() {
#[Test]
public function paramAccessors() {
$this->processor->setParam('a', 'b');
- $this->assertEquals('b', $this->processor->getParam('a'));
+ Assert::equals('b', $this->processor->getParam('a'));
}
#[Test]
@@ -175,7 +171,7 @@ public function baseAccessors() {
$file= Runtime::getInstance()->getExecutable()->getFilename();
$path= rtrim(realpath(dirname($file)), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
$this->processor->setBase($path);
- $this->assertEquals($path, $this->processor->getBase());
+ Assert::equals($path, $this->processor->getBase());
}
#[Test]
@@ -183,7 +179,7 @@ public function setBaseAddsTrailingDirectorySeparator() {
$file= Runtime::getInstance()->getExecutable()->getFilename();
$path= rtrim(realpath(dirname($file)), DIRECTORY_SEPARATOR);
$this->processor->setBase($path);
- $this->assertEquals($path.DIRECTORY_SEPARATOR, $this->processor->getBase());
+ Assert::equals($path.DIRECTORY_SEPARATOR, $this->processor->getBase());
}
#[Test]
@@ -193,9 +189,9 @@ public function setParams() {
'left' => 'one',
'right' => 'two'
]);
- $this->assertEquals('b', $this->processor->getParam('a')) &&
- $this->assertEquals('one', $this->processor->getParam('left')) &&
- $this->assertEquals('two', $this->processor->getParam('right'));
+ Assert::equals('b', $this->processor->getParam('a')) &&
+ Assert::equals('one', $this->processor->getParam('left')) &&
+ Assert::equals('two', $this->processor->getParam('right'));
}
#[Test]
@@ -207,7 +203,7 @@ public function transformationWithEmptyResult() {
');
$this->processor->run();
- $this->assertEquals('', $this->processor->output());
+ Assert::equals('', $this->processor->output());
}
#[Test]
@@ -222,8 +218,8 @@ public function iso88591XslWithoutOutputEncoding() {
');
$this->processor->run();
- $this->assertEquals($this->processorCharset(), $this->processor->outputEncoding());
- $this->assertEquals('übercoder', $this->processor->output());
+ Assert::equals($this->processorCharset(), $this->processor->outputEncoding());
+ Assert::equals('übercoder', $this->processor->output());
}
#[Test]
@@ -238,8 +234,8 @@ public function iso88591XslWithUtf8OutputEncoding() {
');
$this->processor->run();
- $this->assertEquals('utf-8', $this->processor->outputEncoding());
- $this->assertEquals('übercoder', $this->processor->output());
+ Assert::equals('utf-8', $this->processor->outputEncoding());
+ Assert::equals('übercoder', $this->processor->output());
}
#[Test]
@@ -254,8 +250,8 @@ public function utf8XslWithoutOutputEncoding() {
');
$this->processor->run();
- $this->assertEquals($this->processorCharset(), $this->processor->outputEncoding());
- $this->assertEquals('übercoder', $this->processor->output());
+ Assert::equals($this->processorCharset(), $this->processor->outputEncoding());
+ Assert::equals('übercoder', $this->processor->output());
}
#[Test]
@@ -270,8 +266,8 @@ public function utf8XslWithUtf8OutputEncoding() {
');
$this->processor->run();
- $this->assertEquals('utf-8', $this->processor->outputEncoding());
- $this->assertEquals('übercoder', $this->processor->output());
+ Assert::equals('utf-8', $this->processor->outputEncoding());
+ Assert::equals('übercoder', $this->processor->output());
}
#[Test]
@@ -286,8 +282,8 @@ public function utf8XslWithIso88591OutputEncoding() {
');
$this->processor->run();
- $this->assertEquals('iso-8859-1', $this->processor->outputEncoding());
- $this->assertEquals("\xfcbercoder", $this->processor->output());
+ Assert::equals('iso-8859-1', $this->processor->outputEncoding());
+ Assert::equals("\xfcbercoder", $this->processor->output());
}
#[Test]
@@ -302,8 +298,8 @@ public function iso88591XslWithIso88591OutputEncoding() {
');
$this->processor->run();
- $this->assertEquals('iso-8859-1', $this->processor->outputEncoding());
- $this->assertEquals("\xfcbercoder", $this->processor->output());
+ Assert::equals('iso-8859-1', $this->processor->outputEncoding());
+ Assert::equals("\xfcbercoder", $this->processor->output());
}
#[Test]
@@ -333,7 +329,7 @@ public function transformationToHtml() {
');
$this->processor->run();
- $this->assertEquals('Hello', trim($this->processor->output()));
+ Assert::equals('Hello', trim($this->processor->output()));
}
#[Test]
@@ -348,7 +344,7 @@ public function javaScriptInCDataSection() {
');
$this->processor->run();
- $this->assertEquals(
+ Assert::equals(
'',
trim($this->processor->output())
);
@@ -366,7 +362,7 @@ public function omitXmlDeclaration() {
');
$this->processor->run();
- $this->assertEquals('No XML declaration', trim($this->processor->output()));
+ Assert::equals('No XML declaration', trim($this->processor->output()));
}
#[Test]
@@ -481,7 +477,7 @@ public function includingAFile() {
');
$this->processor->run();
- $this->assertEquals('TEST', $this->processor->output());
+ Assert::equals('TEST', $this->processor->output());
}
#[Test]
@@ -496,7 +492,7 @@ public function importingAFile() {
');
$this->processor->run();
- $this->assertEquals('TEST', $this->processor->output());
+ Assert::equals('TEST', $this->processor->output());
}
#[Test]
@@ -508,7 +504,7 @@ public function outputEncodingFromIncludedFile() {
');
$this->processor->run();
- $this->assertEquals('iso-8859-1', $this->processor->outputEncoding());
+ Assert::equals('iso-8859-1', $this->processor->outputEncoding());
}
#[Test]
@@ -520,7 +516,7 @@ public function outputEncodingFromImportedFile() {
');
$this->processor->run();
- $this->assertEquals('iso-8859-1', $this->processor->outputEncoding());
+ Assert::equals('iso-8859-1', $this->processor->outputEncoding());
}
#[Test]
@@ -532,7 +528,7 @@ public function outputEncodingFromIncludedInImportedFile() {
');
$this->processor->run();
- $this->assertEquals('iso-8859-1', $this->processor->outputEncoding());
+ Assert::equals('iso-8859-1', $this->processor->outputEncoding());
}
#[Test]
@@ -544,6 +540,6 @@ public function outputEncodingFromIncludedInIncludedFile() {
');
$this->processor->run();
- $this->assertEquals('iso-8859-1', $this->processor->outputEncoding());
+ Assert::equals('iso-8859-1', $this->processor->outputEncoding());
}
}
\ No newline at end of file
diff --git a/src/test/php/xml/unittest/AbstractXMLParserTest.class.php b/src/test/php/xml/unittest/AbstractXMLParserTest.class.php
index 79617236..17a6be3a 100755
--- a/src/test/php/xml/unittest/AbstractXMLParserTest.class.php
+++ b/src/test/php/xml/unittest/AbstractXMLParserTest.class.php
@@ -1,16 +1,11 @@
parser= new XMLParser();
}
@@ -27,6 +23,7 @@ public function setUp() {
/**
* Tears down test case
*/
+ #[After]
public function tearDown() {
unset($this->parser);
}
@@ -92,7 +89,7 @@ public function onFinish($instance) {
#[Test]
public function withoutDeclaration() {
- $this->assertTrue($this->parser->parse($this->source('', true)));
+ Assert::true($this->parser->parse($this->source('', true)));
}
#[Test, Expect(XMLFormatException::class)]
@@ -102,7 +99,7 @@ public function emptyString() {
#[Test]
public function withDeclaration() {
- $this->assertTrue($this->parser->parse($this->source('')));
+ Assert::true($this->parser->parse($this->source('')));
}
#[Test]
@@ -118,34 +115,34 @@ public function tree() {
'));
- $this->assertEquals('book', $callback->tree[self::NAME]);
- $this->assertEquals([], $callback->tree[self::ATTR]);
+ Assert::equals('book', $callback->tree[self::NAME]);
+ Assert::equals([], $callback->tree[self::ATTR]);
with ($author= $callback->tree[self::CHLD][1]); {
- $this->assertEquals('author', $author[self::NAME]);
- $this->assertEquals([], $author[self::ATTR]);
+ Assert::equals('author', $author[self::NAME]);
+ Assert::equals([], $author[self::ATTR]);
with ($name= $author[self::CHLD][0]); {
- $this->assertEquals('name', $name[self::NAME]);
- $this->assertEquals([], $name[self::ATTR]);
- $this->assertEquals(['Timm'], $name[self::CHLD]);
+ Assert::equals('name', $name[self::NAME]);
+ Assert::equals([], $name[self::ATTR]);
+ Assert::equals(['Timm'], $name[self::CHLD]);
}
}
with ($chapter= $callback->tree[self::CHLD][3]); {
- $this->assertEquals('chapter', $chapter[self::NAME]);
- $this->assertEquals(['id' => '1'], $chapter[self::ATTR]);
+ Assert::equals('chapter', $chapter[self::NAME]);
+ Assert::equals(['id' => '1'], $chapter[self::ATTR]);
with ($title= $chapter[self::CHLD][1]); {
- $this->assertEquals('title', $title[self::NAME]);
- $this->assertEquals([], $title[self::ATTR]);
- $this->assertEquals(['Introduction'], $title[self::CHLD]);
+ Assert::equals('title', $title[self::NAME]);
+ Assert::equals([], $title[self::ATTR]);
+ Assert::equals(['Introduction'], $title[self::CHLD]);
}
with ($paragraph= $chapter[self::CHLD][3]); {
- $this->assertEquals('paragraph', $paragraph[self::NAME]);
- $this->assertEquals([], $paragraph[self::ATTR]);
- $this->assertEquals(['This is where it all started.'], $paragraph[self::CHLD]);
+ Assert::equals('paragraph', $paragraph[self::NAME]);
+ Assert::equals([], $paragraph[self::ATTR]);
+ Assert::equals(['This is where it all started.'], $paragraph[self::CHLD]);
}
}
}
@@ -156,7 +153,7 @@ public function reusable() {
$callback= $this->newCallback();
$this->parser->setCallback($callback);
$this->parser->parse($this->source(''));
- $this->assertEquals(
+ Assert::equals(
['run', ['id' => (string)$i], []],
$callback->tree,
'Run #'.$i
@@ -172,13 +169,13 @@ public function errorOccursLate() {
$this->parser->parse($this->source('Title
Text
'));
$this->fail('Parsed without problems', null, 'xml.XMLFormatException');
} catch (\xml\XMLFormatException $expected) {
- $this->assertEquals(null, $callback->tree, 'Tree only set if entire doc parsed');
+ Assert::equals(null, $callback->tree, 'Tree only set if entire doc parsed');
- $this->assertEquals(4, sizeof($callback->elements));
- $this->assertEquals('doc', $callback->elements[0]);
- $this->assertEquals('h1', $callback->elements[1]);
- $this->assertEquals('p', $callback->elements[2]);
- $this->assertEquals('img', $callback->elements[3]);
+ Assert::equals(4, sizeof($callback->elements));
+ Assert::equals('doc', $callback->elements[0]);
+ Assert::equals('h1', $callback->elements[1]);
+ Assert::equals('p', $callback->elements[2]);
+ Assert::equals('img', $callback->elements[3]);
}
}
@@ -227,7 +224,7 @@ public function quotesInsideAttributes() {
$callback= $this->newCallback();
$this->parser->setCallback($callback);
$this->parser->parse($this->source(''));
- $this->assertEquals(
+ Assert::equals(
['n', ['id' => "'1'", 't' => '"_new"', 'q' => '\'"'], []],
$callback->tree
);
@@ -238,7 +235,7 @@ public function greaterSignInAttribute() {
$callback= $this->newCallback();
$this->parser->setCallback($callback);
$this->parser->parse($this->source(''));
- $this->assertEquals(
+ Assert::equals(
['a', ['id' => '>'], []],
$callback->tree
);
@@ -256,7 +253,7 @@ public function cdataSection() {
$this->parser->parse($this->source('
CDATA [ ]]>]
'));
- $this->assertEquals([
+ Assert::equals([
'doc', [], [
'CDATA [', '<&>', ']'
]
@@ -269,7 +266,7 @@ public function processingInstruction() {
$this->parser->setCallback($callback);
$this->parser->parse($this->source(''));
- $this->assertEquals([
+ Assert::equals([
'doc', [], [
''
]
@@ -282,7 +279,7 @@ public function comment() {
$this->parser->setCallback($callback);
$this->parser->parse($this->source(''));
- $this->assertEquals([
+ Assert::equals([
'doc', [], [
''
]
@@ -306,7 +303,7 @@ public function predefinedEntities() {
"3 < 5 '&' 5 > 3"
'));
- $this->assertEquals([
+ Assert::equals([
'doc', [], [
'"', '3', '<', '5', "'", '&', "'", '5', '>', '3', '"'
]
@@ -321,7 +318,7 @@ public function hexEntity() {
© 2001-2009 the XP team
'));
- $this->assertEquals([
+ Assert::equals([
'doc', [], [
'©', '2001-2009 the XP team'
]
@@ -337,8 +334,8 @@ public function iso88591Conversion() {
The übercoder returns
'));
- $this->assertEquals('iso-8859-1', $callback->encoding);
- $this->assertEquals([
+ Assert::equals('iso-8859-1', $callback->encoding);
+ Assert::equals([
'doc', [], [
'The', 'übercoder returns'
]
@@ -354,8 +351,8 @@ public function utf8Conversion() {
The übercoder returns
'));
- $this->assertEquals('utf-8', $callback->encoding);
- $this->assertEquals([
+ Assert::equals('utf-8', $callback->encoding);
+ Assert::equals([
'doc', [], [
'The', 'übercoder returns'
]
@@ -391,7 +388,7 @@ public function characterEntity() {
Copyright: ©
'));
- $this->assertEquals([
+ Assert::equals([
'doc', [], [
'Copyright:', '©'
]
@@ -407,7 +404,7 @@ public function entity() {
Copyright: ©right;
'));
- $this->assertEquals([
+ Assert::equals([
'doc', [], [
'Copyright:', '©right;'
]
@@ -423,7 +420,7 @@ public function entityInAttribute() {
'));
- $this->assertEquals([
+ Assert::equals([
'doc', [], [
['book', ['copyright' => 'Copyright 2009 The XP team'], []],
]
@@ -442,7 +439,7 @@ public function entityExpansion() {
'));
- $this->assertEquals([
+ Assert::equals([
'doc', [], [
['book', ['copyright' => 'Copyright 2009 The XP team'], []],
]
@@ -458,7 +455,7 @@ public function externalEntity() {
Copyright: ©right;
'));
- $this->assertEquals([
+ Assert::equals([
'doc', [], ['Copyright:'],
], $callback->tree);
}
diff --git a/src/test/php/xml/unittest/ApplicationType.class.php b/src/test/php/xml/unittest/ApplicationType.class.php
index 35d41723..4cd218cd 100755
--- a/src/test/php/xml/unittest/ApplicationType.class.php
+++ b/src/test/php/xml/unittest/ApplicationType.class.php
@@ -2,13 +2,7 @@
use xml\Xmlns;
-/**
- * Test class for Marshaller / Unmarshaller tests
- *
- * @see xp://xml.unittest.UnmarshallerTest
- * @see xp://xml.unittest.MarshallerTest
- */
#[Xmlns(app: 'http://projects.xp-framework.net/xmlns/app')]
class ApplicationType {
-}
+}
\ No newline at end of file
diff --git a/src/test/php/xml/unittest/ButtonType.class.php b/src/test/php/xml/unittest/ButtonType.class.php
index 6dc86e89..45f8ae0d 100755
--- a/src/test/php/xml/unittest/ButtonType.class.php
+++ b/src/test/php/xml/unittest/ButtonType.class.php
@@ -2,12 +2,6 @@
use xml\{Xmlfactory, Xmlmapping};
-/**
- * Test class for Marshaller / Unmarshaller tests. Used by
- * DialogType.
- *
- * @see xp://xml.unittest.DialogType
- */
class ButtonType {
public $id= '';
public $caption= '';
diff --git a/src/test/php/xml/unittest/DialogType.class.php b/src/test/php/xml/unittest/DialogType.class.php
index abd22612..ffd68698 100755
--- a/src/test/php/xml/unittest/DialogType.class.php
+++ b/src/test/php/xml/unittest/DialogType.class.php
@@ -2,13 +2,6 @@
use xml\{Xmlfactory, Xmlmapping};
-/**
- * Test class for Marshaller / Unmarshaller tests
- *
- * @see xp://xml.unittest.UnmarshallerTest
- * @see xp://xml.unittest.MarshallerTest
- * @see rfc://0040
- */
class DialogType {
public
$id = '',
diff --git a/src/test/php/xml/unittest/DocumentTest.class.php b/src/test/php/xml/unittest/DocumentTest.class.php
index 871ba083..3cc9ae48 100755
--- a/src/test/php/xml/unittest/DocumentTest.class.php
+++ b/src/test/php/xml/unittest/DocumentTest.class.php
@@ -1,14 +1,9 @@
Alex
');
- $this->assertEquals(
+ Assert::equals(
$dom->getDocumentElement()->getChildren(),
$dom->getElementsByTagName('person')
);
@@ -30,7 +25,7 @@ public function elementById() {
Alex
');
- $this->assertEquals(
+ Assert::equals(
$dom->getDocumentElement()->nodeAt(0),
$dom->getElementById('1549')
);
@@ -46,7 +41,7 @@ public function elementsByName() {
');
- $this->assertEquals(
+ Assert::equals(
[$dom->getDocumentElement()->nodeAt(0)->nodeAt(0)],
$dom->getElementsByName('package')
);
@@ -67,7 +62,7 @@ public function nestedElementById() {