cvs: php-src /ext/dom/tests regsiter_node_class.phpt
| From: | Rob Richards | Date: | Mon, 22 May 2006 17:05:38 +0000 |
| Subject: | cvs: php-src /ext/dom/tests regsiter_node_class.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-38364@lists.php.net to get a copy of this message | ||
rrichards Mon May 22 17:05:38 2006 UTC
Added files:
/php-src/ext/dom/tests regsiter_node_class.phpt
Log:
add test
http://cvs.php.net/viewcvs.cgi/php-src/ext/dom/tests/regsiter_node_class.phpt?view=markup&rev=1.1
Index: php-src/ext/dom/tests/regsiter_node_class.phpt
+++ php-src/ext/dom/tests/regsiter_node_class.phpt
--TEST--
Test: registerNodeClass()
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
class myAttribute extends DOMAttr {
function testit() { return "HELLO Attribute"; }
}
class myElement extends DOMElement {
function testit() { return "HELLO Element"; }
}
$doc = new DOMDocument();
$doc->registerNodeClass('DOMAttr', 'myAttribute');
$doc->registerNodeClass('DOMElement', 'myElement');
$doc->appendChild(new DOMElement('root'));
$root = $doc->documentElement;
$root->setAttribute('a', 'a1');
var_dump($root);
print $root->testit()."\n";
$attr = $root->getAttributeNode('a');
var_dump($attr);
print $attr->testit()."\n";
unset($attr);
$doc->registerNodeClass('DOMAttr', NULL);
$attr = $root->getAttributeNode('a');
var_dump($attr);
print $attr->testit()."\n";
?>
--EXPECTF--
object(myElement)#%d (0) {
}
HELLO Element
object(myAttribute)#%d (0) {
}
HELLO Attribute
object(DOMAttr)#%d (0) {
}
Fatal error: Call to undefined method DOMAttr::testit() in %s on line 25