summaryrefslogtreecommitdiff
path: root/ext/xmlwriter/tests/OO_009.phpt
diff options
context:
space:
mode:
authorRob Richards <rrichards@php.net>2005-12-09 04:57:20 (GMT)
committerRob Richards <rrichards@php.net>2005-12-09 04:57:20 (GMT)
commitc98ef984d8c9d4e0f89e4d363e264c85bb7cff38 (patch)
tree55b56816fd783a4864fcf18a614cd20c571e6fb4 /ext/xmlwriter/tests/OO_009.phpt
parent6b86285dd24321e579e5c6008b4c47d519083ad0 (diff)
downloadphp-c98ef984d8c9d4e0f89e4d363e264c85bb7cff38.tar.gz
MFH: enable a few additional functions
- add tests
Diffstat (limited to 'ext/xmlwriter/tests/OO_009.phpt')
-rw-r--r--ext/xmlwriter/tests/OO_009.phpt44
1 files changed, 44 insertions, 0 deletions
diff --git a/ext/xmlwriter/tests/OO_009.phpt b/ext/xmlwriter/tests/OO_009.phpt
new file mode 100644
index 0000000..659cfc8
--- /dev/null
+++ b/ext/xmlwriter/tests/OO_009.phpt
@@ -0,0 +1,44 @@
+--TEST--
+XMLWriter: PI, Comment, CDATA
+--SKIPIF--
+<?php
+if (!extension_loaded("xmlwriter")) die("skip");
+if (!function_exists("$xw->start_comment")) die("skip: libxml2 2.6.7+ required");
+?>
+--FILE--
+<?php
+/* $Id$ */
+
+$xw = new XMLWriter();
+$xw->openMemory();
+$xw->setIndent(TRUE);
+$xw->startDocument("1.0", "UTF-8");
+$xw->startElement('root');
+$xw->writeAttribute('id', 'elem1');
+$xw->startElement('elem1');
+$xw->writeAttribute('attr1', 'first');
+$xw->writeComment('start PI');
+$xw->startElement('pi');
+$xw->writePi('php', 'echo "hello world"; ');
+$xw->endElement();
+$xw->startElement('cdata');
+$xw->startCdata();
+$xw->endElement();
+$xw->text('<>&"');
+$xw->endCdata();
+$xw->endElement();
+$xw->endElement();
+$xw->endDocument();
+// Force to write and empty the buffer
+$output = $xw->flush(true);
+print $output;
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<root id="elem1">
+ <elem1 attr1="first">
+ <!--start PI-->
+ <pi><?php echo "hello world"; ?></pi>
+ <cdata><![CDATA[<>&"]]></cdata>
+ </elem1>
+</root>