Annotation of embedaddon/php/ext/dom/tests/dom_set_attr_node.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test: setAttributeNode()
! 3: --SKIPIF--
! 4: <?php require_once('skipif.inc'); ?>
! 5: --FILE--
! 6: <?php
! 7:
! 8: $xml = <<<HERE
! 9: <?xml version="1.0" ?>
! 10: <root a="b" />
! 11: HERE;
! 12:
! 13: $xml2 = <<<HERE
! 14: <?xml version="1.0" ?>
! 15: <doc2 />
! 16: HERE;
! 17:
! 18: $dom = new DOMDocument();
! 19: $dom->loadXML($xml);
! 20: $root = $dom->documentElement;
! 21: $attr = $root->getAttributeNode('a');
! 22:
! 23: $dom2 = new DOMDocument();
! 24: $dom2->loadXML($xml2);
! 25: $root2 = $dom2->documentElement;
! 26: try {
! 27: $root2->setAttributeNode($attr);
! 28: } catch (domexception $e) {
! 29: var_dump($e);
! 30: }
! 31:
! 32: ?>
! 33: --EXPECTF--
! 34: object(DOMException)#%d (7) {
! 35: ["message":protected]=>
! 36: string(20) "Wrong Document Error"
! 37: ["string":"Exception":private]=>
! 38: string(0) ""
! 39: ["file":protected]=>
! 40: string(%d) "%sdom_set_attr_node.php"
! 41: ["line":protected]=>
! 42: int(%d)
! 43: ["trace":"Exception":private]=>
! 44: array(1) {
! 45: [0]=>
! 46: array(6) {
! 47: ["file"]=>
! 48: string(%d) "%sdom_set_attr_node.php"
! 49: ["line"]=>
! 50: int(%d)
! 51: ["function"]=>
! 52: string(16) "setAttributeNode"
! 53: ["class"]=>
! 54: string(10) "DOMElement"
! 55: ["type"]=>
! 56: string(2) "->"
! 57: ["args"]=>
! 58: array(1) {
! 59: [0]=>
! 60: object(DOMAttr)#%d (0) {
! 61: }
! 62: }
! 63: }
! 64: }
! 65: ["previous":"Exception":private]=>
! 66: NULL
! 67: ["code"]=>
! 68: int(4)
! 69: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>