xref: /php-src/ext/xmlwriter/tests/OO_005.phpt (revision 9871a624)
1--TEST--
2XMLWriter: libxml2 XML Writer, comments
3--EXTENSIONS--
4xmlwriter
5--FILE--
6<?php
7
8$doc_dest = 'OO_005.xml';
9$xw = new XMLWriter();
10$xw->openUri($doc_dest);
11$xw->startDocument('1.0', 'UTF-8');
12$xw->startElement("tag1");
13$xw->startComment();
14$xw->text('comment');
15$xw->endComment();
16$xw->writeComment("comment #2");
17$xw->endDocument();
18
19// Force to write and empty the buffer
20$output_bytes = $xw->flush(true);
21echo file_get_contents($doc_dest);
22unset($xw);
23unlink($doc_dest);
24?>
25--EXPECT--
26<?xml version="1.0" encoding="UTF-8"?>
27<tag1><!--comment--><!--comment #2--></tag1>
28