diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2013-03-14 05:42:27 +0000 |
---|---|---|
committer | <> | 2013-04-03 16:25:08 +0000 |
commit | c4dd7a1a684490673e25aaf4fabec5df138854c4 (patch) | |
tree | 4d57c44caae4480efff02b90b9be86f44bf25409 /ext/xmlwriter/tests/OO_009.phpt | |
download | php2-master.tar.gz |
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/xmlwriter/tests/OO_009.phpt')
-rw-r--r-- | ext/xmlwriter/tests/OO_009.phpt | 45 |
1 files changed, 45 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..c874f3e --- /dev/null +++ b/ext/xmlwriter/tests/OO_009.phpt @@ -0,0 +1,45 @@ +--TEST-- +XMLWriter: PI, Comment, CDATA +--SKIPIF-- +<?php +if (!extension_loaded("xmlwriter")) die("skip"); +?> +--FILE-- +<?php +/* $Id$ */ +/* +Libxml 2.6.24 and up adds a new line after a processing instruction (PI) +*/ +$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->text('<>&"'); +$xw->endCdata(); +$xw->endElement(); +$xw->endElement(); +$xw->endElement(); +$xw->endDocument(); +// Force to write and empty the buffer +$output = $xw->flush(true); +print $output; +?> +--EXPECTF-- +<?xml version="1.0" encoding="UTF-8"?> +<root id="elem1"> + <elem1 attr1="first"> + <!--start PI--> + <pi><?php echo "hello world"; ?>%w</pi> + <cdata><![CDATA[<>&"]]></cdata> + </elem1> +</root> |