summaryrefslogtreecommitdiff
path: root/ext/dom/tests/DOM4_ParentNode_append_with_attributes.phpt
blob: f2c6aa9a6d1bd1ba3763998dbb769ea94522b97a (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
--TEST--
DOMParentNode::append() with attributes
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once("dom_test.inc");

$dom = new DOMDocument;
$dom->loadXML('<test attr-one="21"/>');

$replacement = $dom->createAttribute('attr-one');
$replacement->value ='42';
$addition = $dom->createAttribute('attr-two');
$addition->value = '23';

$element = $dom->documentElement;

try {
    $element->append($replacement, $addition);
} catch (DOMException $e) {
    echo $e->getMessage() . "\n";
}

echo $dom->saveXML();
?>
--EXPECT--
Hierarchy Request Error
<?xml version="1.0"?>
<test attr-one="21"/>