xref: /PHP-7.0/ext/xmlwriter/tests/OO_005.phpt (revision bcd9356d)
1--TEST--
2XMLWriter: libxml2 XML Writer, comments
3--SKIPIF--
4<?php
5if (!extension_loaded("xmlwriter")) die("skip");
6if (!function_exists("xmlwriter_start_comment")) die("skip: libxml2 2.6.7+ required");
7?>
8--FILE--
9<?php
10/* $Id$ */
11
12$doc_dest = '001.xml';
13$xw = new XMLWriter();
14$xw->openUri($doc_dest);
15$xw->startDocument('1.0', 'UTF-8');
16$xw->startElement("tag1");
17$xw->startComment();
18$xw->text('comment');
19$xw->endComment();
20$xw->writeComment("comment #2");
21$xw->endDocument();
22
23// Force to write and empty the buffer
24$output_bytes = $xw->flush(true);
25echo file_get_contents($doc_dest);
26unset($xw);
27unlink('001.xml');
28?>
29===DONE===
30--EXPECT--
31<?xml version="1.0" encoding="UTF-8"?>
32<tag1><!--comment--><!--comment #2--></tag1>
33===DONE===
34