mirror of
https://github.com/php/php-src.git
synced 2024-10-04 00:06:16 +00:00
92bbe6be72
Each file covers a different test case DOMNode_insertBefore_error2.phpt: refNode is a sibling of the node where newNode wanted to be inserted. DOMNode_insertBefore_error3.phpt: refNode is the parent of the node where newNode wanted to be inserted. DOMNode_insertBefore_error4.phpt: refNode is a brand new node. DOMNode_insertBefore_error5.phpt: refNode is a descendant (not child) of the node where newNode wanted to be inserted. DOMNode_insertBefore_error6.phpt: refNode is the node where newNode wanted to be inserted.
39 lines
924 B
PHP
39 lines
924 B
PHP
--TEST--
|
|
Test DOMNode::insertBefore() check the error code DOM_NOT_FOUND is raised
|
|
--DESCRIPTION--
|
|
DOMNode::insertBefore(newNode, [refNode])
|
|
DOM_NOT_FOUND is raised if refnode is not a child
|
|
This test checks the error message is raised when the refnode is a brand new node
|
|
--CREDITS--
|
|
Antonio Diaz Ruiz <dejalatele@gmail.com>
|
|
--INI--
|
|
assert.bail=true
|
|
--SKIPIF--
|
|
<?php include('skipif.inc'); ?>
|
|
--FILE--
|
|
<?php
|
|
$dom = new DOMDocument();
|
|
|
|
$doc = $dom->load(dirname(__FILE__) . "/book.xml", LIBXML_NOBLANKS);
|
|
assert('$doc === true');
|
|
|
|
$parent_node = $dom->getElementsByTagName("book")->item(0);
|
|
assert('!is_null($parent_node)');
|
|
|
|
$new_node = $dom->createElement('newnode');
|
|
assert('$new_node !== false');
|
|
|
|
// could be a brand new node
|
|
|
|
$ref_node = $dom->createElement('newnode2');
|
|
|
|
try {
|
|
$parent_node->insertBefore($new_node, $ref_node);
|
|
} catch(DOMException $e) {
|
|
echo $e->getMessage();
|
|
}
|
|
|
|
?>
|
|
--EXPECT--
|
|
Not Found Error
|