summaryrefslogtreecommitdiff
path: root/t/inc/Xml.t
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2007-05-16 20:58:53 +0000
committerPierre Schmitz <pierre@archlinux.de>2007-05-16 20:58:53 +0000
commitcecb985bee3bdd252e1b8dc0bd500b37cd52be01 (patch)
tree17266aa237742640aabee7856f0202317a45d540 /t/inc/Xml.t
parent0bac06c301f2a83edb0236e4c2434da16848d549 (diff)
Aktualisierung auf MediaWiki 1.10.0
Plugins angepasst und verbessert kleine Korrekturen am Design
Diffstat (limited to 't/inc/Xml.t')
-rw-r--r--t/inc/Xml.t56
1 files changed, 56 insertions, 0 deletions
diff --git a/t/inc/Xml.t b/t/inc/Xml.t
new file mode 100644
index 00000000..bf95cce2
--- /dev/null
+++ b/t/inc/Xml.t
@@ -0,0 +1,56 @@
+#!/usr/bin/env php
+<?php
+
+require 'Test.php';
+
+plan( 8 );
+
+require_ok( 'includes/Sanitizer.php' );
+require_ok( 'includes/Xml.php' );
+
+#
+# element
+#
+
+cmp_ok(
+ Xml::element( 'element', null, null ),
+ '==',
+ '<element>',
+ 'Opening element with no attributes'
+);
+
+cmp_ok(
+ Xml::element( 'element', null, '' ),
+ '==',
+ '<element />',
+ 'Terminated empty element'
+);
+
+cmp_ok(
+ Xml::element( 'element', null, 'hello <there> you & you' ),
+ '==',
+ '<element>hello &lt;there&gt; you &amp; you</element>',
+ 'Element with no attributes and content that needs escaping'
+);
+
+cmp_ok(
+ Xml::element( 'element', array( 'key' => 'value', '<>' => '<>' ), null ),
+ '==',
+ '<element key="value" <>="&lt;&gt;">',
+ 'Element attributes, keys are not escaped'
+);
+
+#
+# open/close element
+#
+
+cmp_ok(
+ Xml::openElement( 'element', array( 'k' => 'v' ) ),
+ '==',
+ '<element k="v">',
+ 'openElement() shortcut'
+);
+
+cmp_ok( Xml::closeElement( 'element' ), '==', '</element>', 'closeElement() shortcut' );
+
+?> \ No newline at end of file