xref: /PHP-7.3/ext/xmlwriter/tests/OO_011.phpt (revision 8d3f8ca1)
1--TEST--
2XMLWriter: libxml2 XML Writer, fullEndElement method
3--CREDITS--
4Mauricio Vieira <mauricio [at] @mauriciovieira [dot] net>
5#testfest PHPSP on 2014-07-05
6--SKIPIF--
7<?php
8if (!extension_loaded("xmlwriter")) die("skip");
9if (LIBXML_VERSION < 20701) die("skip: libxml2 2.7.1+ required");
10?>
11--FILE--
12<?php
13
14$xw = new XMLWriter();
15$xw->openMemory();
16$xw->setIndent(TRUE);
17$xw->setIndentString('   ');
18$xw->startDocument('1.0', "UTF-8");
19$xw->startElement('root');
20$xw->startElementNS('ns1', 'child1', 'urn:ns1');
21$xw->writeAttributeNS('ns1', 'att1', 'urn:ns1', '<>"\'&');
22$xw->writeElement('chars', "special characters: <>\"'&");
23$xw->endElement();
24$xw->startElement('empty');
25$xw->fullEndElement();
26$xw->fullEndElement();
27// Force to write and empty the buffer
28$output = $xw->flush(true);
29print $output;
30?>
31--EXPECT--
32<?xml version="1.0" encoding="UTF-8"?>
33<root>
34   <ns1:child1 ns1:att1="&lt;&gt;&quot;'&amp;" xmlns:ns1="urn:ns1">
35      <chars>special characters: &lt;&gt;&quot;'&amp;</chars>
36   </ns1:child1>
37   <empty></empty>
38</root>
39