summaryrefslogtreecommitdiff
path: root/ext/xmlwriter/tests/OO_003.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/xmlwriter/tests/OO_003.phpt')
-rw-r--r--ext/xmlwriter/tests/OO_003.phpt37
1 files changed, 37 insertions, 0 deletions
diff --git a/ext/xmlwriter/tests/OO_003.phpt b/ext/xmlwriter/tests/OO_003.phpt
new file mode 100644
index 0000000..7fb4791
--- /dev/null
+++ b/ext/xmlwriter/tests/OO_003.phpt
@@ -0,0 +1,37 @@
+--TEST--
+XMLWriter: libxml2 XML Writer, membuffer, flush, text, attribute
+--SKIPIF--
+<?php if (!extension_loaded("xmlwriter")) print "skip"; ?>
+--FILE--
+<?php
+/* $Id$ */
+
+$xw = new XMLWriter();
+$xw->openMemory();
+$xw->startDocument('1.0', 'UTF-8');
+$xw->startElement("tag1");
+
+$res = $xw->startAttribute('attr1');
+$xw->text("attr1_value");
+$xw->endAttribute();
+
+$res = $xw->startAttribute('attr2');
+$xw->text("attr2_value");
+$xw->endAttribute();
+
+$xw->text("Test text for tag1");
+$res = $xw->startElement('tag2');
+if ($res < 1) {
+ echo "StartElement context validation failed\n";
+ exit();
+}
+$xw->endDocument();
+
+// Force to write and empty the buffer
+echo $xw->flush(true);
+?>
+===DONE===
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<tag1 attr1="attr1_value" attr2="attr2_value">Test text for tag1<tag2/></tag1>
+===DONE===