xref: /PHP-7.4/ext/xmlwriter/tests/010.phpt (revision 26dfce7f)
1--TEST--
2xmlwriter_start/end_attribute()
3--SKIPIF--
4<?php
5if (!extension_loaded("xmlwriter")) die("skip");
6?>
7--FILE--
8<?php
9
10$file = __DIR__.'/010.tmp';
11
12$xw = xmlwriter_open_uri($file);
13
14var_dump(xmlwriter_start_element($xw, "tag"));
15var_dump(xmlwriter_start_attribute($xw, "attr"));
16var_dump(xmlwriter_end_attribute($xw));
17var_dump(xmlwriter_start_attribute($xw, "-1"));
18var_dump(xmlwriter_end_attribute($xw));
19var_dump(xmlwriter_start_attribute($xw, "\""));
20var_dump(xmlwriter_end_attribute($xw));
21var_dump(xmlwriter_end_element($xw));
22
23unset($xw);
24
25var_dump(file_get_contents($file));
26
27@unlink($file);
28
29echo "Done\n";
30?>
31--EXPECTF--
32bool(true)
33bool(true)
34bool(true)
35
36Warning: xmlwriter_start_attribute(): Invalid Attribute Name in %s on line %d
37bool(false)
38bool(false)
39
40Warning: xmlwriter_start_attribute(): Invalid Attribute Name in %s on line %d
41bool(false)
42bool(false)
43bool(true)
44string(14) "<tag attr=""/>"
45Done
46