summaryrefslogtreecommitdiff
path: root/ext/xmlwriter/tests/xmlwriter_write_attribute_ns_error_001.phpt
blob: 25167231393282212b6fd7101160e3d1c22be678 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
--TEST--
xmlwriter_write_attribute_ns with missing param
--SKIPIF--
<?php if (!extension_loaded("xmlwriter")) print "skip"; ?>
--FILE--
<?php
$xw = xmlwriter_open_memory();
xmlwriter_set_indent($xw, TRUE);
xmlwriter_start_document($xw, NULL, "UTF-8");
xmlwriter_start_element($xw, 'root');
xmlwriter_write_attribute_ns($xw, 'prefix', '', 'http://www.php.net/uri');
xmlwriter_start_element($xw, 'elem1');
xmlwriter_write_attribute($xw, 'attr1', 'first');
xmlwriter_end_element($xw);
xmlwriter_full_end_element($xw);
xmlwriter_end_document($xw);

$output = xmlwriter_flush($xw, true);
print $output;

// write attribute_ns without start_element first
$xw = xmlwriter_open_memory();
var_dump(xmlwriter_write_attribute_ns($xw, 'prefix', 'id', 'http://www.php.net/uri', 'elem1'));
print xmlwriter_output_memory($xw);
?>
--CREDIT--
Koen Kuipers koenk82@gmail.com
--EXPECTF--

Warning: xmlwriter_write_attribute_ns() expects exactly %d parameters, %d given in %s on line %d
<?xml version="1.0" encoding="UTF-8"?>
<root>
 <elem1 attr1="first"/>
</root>
bool(false)