mirror of
https://github.com/php/php-src.git
synced 2024-12-19 06:50:17 +08:00
Merge branch 'PHP-5.4' into PHP-5.5
This commit is contained in:
commit
6b1928ba0b
@ -13,7 +13,7 @@ require_once('skipif.inc');
|
||||
require_once('dom_test.inc');
|
||||
|
||||
chdir(__DIR__);
|
||||
$XMLStringGood = file_get_contents('note.xml');
|
||||
$XMLStringGood = file_get_contents(dirname(__FILE__).'/note.xml');
|
||||
|
||||
$dom = new DOMDocument;
|
||||
$dom->resolveExternals = TRUE;
|
||||
|
38
ext/dom/tests/DOMNode_insertBefore_error2.phpt
Normal file
38
ext/dom/tests/DOMNode_insertBefore_error2.phpt
Normal file
@ -0,0 +1,38 @@
|
||||
--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 sibling
|
||||
--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');
|
||||
|
||||
// getting a sibling as reference node to insert
|
||||
|
||||
$ref_node = $dom->getElementsByTagName("book")->item(1);
|
||||
|
||||
try {
|
||||
$parent_node->insertBefore($new_node, $ref_node);
|
||||
} catch(DOMException $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Not Found Error
|
39
ext/dom/tests/DOMNode_insertBefore_error3.phpt
Normal file
39
ext/dom/tests/DOMNode_insertBefore_error3.phpt
Normal file
@ -0,0 +1,39 @@
|
||||
--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 refnode is the parent 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');
|
||||
|
||||
// getting the parent node as reference node to insert
|
||||
|
||||
$ref_node = $dom->getElementsByTagName("book")->item(0)->parentNode;
|
||||
assert('!is_null($ref_node)');
|
||||
|
||||
try {
|
||||
$parent_node->insertBefore($new_node, $ref_node);
|
||||
} catch(DOMException $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Not Found Error
|
38
ext/dom/tests/DOMNode_insertBefore_error4.phpt
Normal file
38
ext/dom/tests/DOMNode_insertBefore_error4.phpt
Normal file
@ -0,0 +1,38 @@
|
||||
--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
|
40
ext/dom/tests/DOMNode_insertBefore_error5.phpt
Normal file
40
ext/dom/tests/DOMNode_insertBefore_error5.phpt
Normal file
@ -0,0 +1,40 @@
|
||||
--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 descendant but not a child
|
||||
--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');
|
||||
|
||||
// creating a new node (descendant) and getting it as the refnode
|
||||
|
||||
$ref_node = $dom->createElement('newnode3');
|
||||
$parent_node->childNodes->item(0)->appendChild($ref_node);
|
||||
$dom->saveXML();
|
||||
|
||||
try {
|
||||
$parent_node->insertBefore($new_node, $ref_node);
|
||||
} catch(DOMException $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Not Found Error
|
35
ext/dom/tests/DOMNode_insertBefore_error6.phpt
Normal file
35
ext/dom/tests/DOMNode_insertBefore_error6.phpt
Normal file
@ -0,0 +1,35 @@
|
||||
--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 the parent
|
||||
--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)');
|
||||
$ref_node = $parent_node;
|
||||
|
||||
$new_node = $dom->createElement('newnode');
|
||||
assert('$new_node !== false');
|
||||
|
||||
try {
|
||||
$parent_node->insertBefore($new_node, $ref_node);
|
||||
} catch(DOMException $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Not Found Error
|
Loading…
Reference in New Issue
Block a user