From ca7712d70d250c50fe79383b5bac0e14256b6a7a Mon Sep 17 00:00:00 2001 From: Steve Seear Date: Mon, 19 May 2008 12:21:18 +0000 Subject: [PATCH] Tests from PHP London TestFest 2008 --- ext/dom/DOMComment_appendData_basic.phpt | 21 +++++++++ ext/dom/DOMElement_hasAttributes_basic.phpt | 49 +++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 ext/dom/DOMComment_appendData_basic.phpt create mode 100644 ext/dom/DOMElement_hasAttributes_basic.phpt diff --git a/ext/dom/DOMComment_appendData_basic.phpt b/ext/dom/DOMComment_appendData_basic.phpt new file mode 100644 index 0000000000..c756f1665a --- /dev/null +++ b/ext/dom/DOMComment_appendData_basic.phpt @@ -0,0 +1,21 @@ +--TEST-- +Test adding data to a DOMComment +--CREDITS-- +Andrew Larssen +London TestFest 2008 +--SKIPIF-- + +--FILE-- +createComment('test-comment'); +$comment->appendData('-more-data'); +$dom->appendChild($comment); +$dom->saveXML(); +echo $dom->saveXML(); + +?> +--EXPECTF-- + + \ No newline at end of file diff --git a/ext/dom/DOMElement_hasAttributes_basic.phpt b/ext/dom/DOMElement_hasAttributes_basic.phpt new file mode 100644 index 0000000000..f0d0c355b8 --- /dev/null +++ b/ext/dom/DOMElement_hasAttributes_basic.phpt @@ -0,0 +1,49 @@ +--TEST-- +DOMNode: hasAttributes() +--CREDITS-- +James Lewis +#TestFest 2008 +--FILE-- +loadXML($xmlstr); +if(!$dom) { + echo "Error while parsing the document\n"; + exit; +} + +$element = $dom->documentElement; + +echo "Verify that we have a DOMElement object:\n"; +var_dump($element); + +echo "\nElement should have attributes:\n"; +var_dump($element->hasAttributes()); + +$nodelist=$dom->getElementsByTagName('tbody') ; +$element = $nodelist->item(0); + +echo "\nVerify that we have a DOMElement object:\n"; +var_dump($element); + +echo "\nElement should have no attributes:\n"; +var_dump($element->hasAttributes()) + + +?> +--EXPECTF-- +Verify that we have a DOMElement object: +object(DOMElement)#%d (0) { +} + +Element should have attributes: +bool(true) + +Verify that we have a DOMElement object: +object(DOMElement)#%d (0) { +} + +Element should have no attributes: +bool(false) -- 2.40.0