diff options
author | Ondřej Surý <ondrej@sury.org> | 2013-06-21 13:48:35 +0200 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2013-06-21 13:48:35 +0200 |
commit | 706ac6417162d94eb701952d40df136cd9528b56 (patch) | |
tree | 1858b0f397d16519dbd73c998d7a89001af362d2 /ext/dom/tests | |
parent | e2d52710fa3134e72662116b3b495f5a22cf9c72 (diff) | |
download | php-upstream/5.5.0+dfsg.tar.gz |
New upstream version 5.5.0+dfsgupstream/5.5.0+dfsg
Diffstat (limited to 'ext/dom/tests')
-rw-r--r-- | ext/dom/tests/DOMDocument_loadHTMLfile.phpt | 17 | ||||
-rw-r--r-- | ext/dom/tests/DOMDocument_loadHTMLfile_error1.phpt | 18 | ||||
-rw-r--r-- | ext/dom/tests/DOMDocument_loadHTMLfile_error2.phpt | 18 | ||||
-rw-r--r-- | ext/dom/tests/DOMDocument_loadHTMLfile_variation1.phpt | 18 | ||||
-rw-r--r-- | ext/dom/tests/DOMDocument_loadHTMLfile_variation2.phpt | 17 | ||||
-rw-r--r-- | ext/dom/tests/DOMNode_removeChild_basic.phpt | 4 | ||||
-rw-r--r-- | ext/dom/tests/empty.html | 0 | ||||
-rw-r--r-- | ext/dom/tests/not_well.html | 8 |
8 files changed, 98 insertions, 2 deletions
diff --git a/ext/dom/tests/DOMDocument_loadHTMLfile.phpt b/ext/dom/tests/DOMDocument_loadHTMLfile.phpt new file mode 100644 index 000000000..93a614903 --- /dev/null +++ b/ext/dom/tests/DOMDocument_loadHTMLfile.phpt @@ -0,0 +1,17 @@ +--TEST-- +Test DOMDocument::loadHTMLFile +--DESCRIPTION-- +Verifies the basic behaviour of the method +--CREDITS-- +Antonio Diaz Ruiz <dejalatele@gmail.com> +--INI-- +assert.bail=true +--SKIPIF-- +<?php include('skipif.inc'); ?> +--FILE-- +<?php +$doc = new DOMDocument(); +$result = $doc->loadHTMLFile(dirname(__FILE__) . "/test.html"); +assert('$result === true'); +?> +--EXPECT-- diff --git a/ext/dom/tests/DOMDocument_loadHTMLfile_error1.phpt b/ext/dom/tests/DOMDocument_loadHTMLfile_error1.phpt new file mode 100644 index 000000000..aee51966a --- /dev/null +++ b/ext/dom/tests/DOMDocument_loadHTMLfile_error1.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test DOMDocument::loadHTMLFile when the file doesn't exist +--DESCRIPTION-- +Verifies that an error message is showed if the file doesn't exist +--CREDITS-- +Antonio Diaz Ruiz <dejalatele@gmail.com> +--INI-- +assert.bail=true +--SKIPIF-- +<?php include('skipif.inc'); ?> +--FILE-- +<?php +$doc = new DOMDocument(); +$result = $doc->loadHTMLFile(dirname(__FILE__) . "/ffff/test.html"); +assert('$result === false'); +?> +--EXPECTF-- +%r(PHP ){0,1}%rWarning: DOMDocument::loadHTMLFile(): I/O warning : failed to load external entity %s diff --git a/ext/dom/tests/DOMDocument_loadHTMLfile_error2.phpt b/ext/dom/tests/DOMDocument_loadHTMLfile_error2.phpt new file mode 100644 index 000000000..e59ff56c5 --- /dev/null +++ b/ext/dom/tests/DOMDocument_loadHTMLfile_error2.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test DOMDocument::loadHTMLFile when an empty string is passed +--DESCRIPTION-- +Verifies that an error message is showed if an empty string is passed as argument +--CREDITS-- +Antonio Diaz Ruiz <dejalatele@gmail.com> +--INI-- +assert.bail=true +--SKIPIF-- +<?php include('skipif.inc'); ?> +--FILE-- +<?php +$doc = new DOMDocument(); +$result = $doc->loadHTMLFile(""); +assert('$result === false'); +?> +--EXPECTF-- +%r(PHP ){0,1}%rWarning: DOMDocument::loadHTMLFile(): Empty string supplied as input %s diff --git a/ext/dom/tests/DOMDocument_loadHTMLfile_variation1.phpt b/ext/dom/tests/DOMDocument_loadHTMLfile_variation1.phpt new file mode 100644 index 000000000..2535772c7 --- /dev/null +++ b/ext/dom/tests/DOMDocument_loadHTMLfile_variation1.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test DOMDocument::loadHTMLFile when an empty document is loaded +--DESCRIPTION-- +Verifies that an warning message is showed if an empty document is loaded +--CREDITS-- +Antonio Diaz Ruiz <dejalatele@gmail.com> +--INI-- +assert.bail=true +--SKIPIF-- +<?php include('skipif.inc'); ?> +--FILE-- +<?php +$doc = new DOMDocument(); +$result = $doc->loadHTMLFile(dirname(__FILE__) . "/empty.html"); +assert('$result === true'); +?> +--EXPECTF-- +%r(PHP ){0,1}%rWarning: DOMDocument::loadHTMLFile(): Document is empty %s diff --git a/ext/dom/tests/DOMDocument_loadHTMLfile_variation2.phpt b/ext/dom/tests/DOMDocument_loadHTMLfile_variation2.phpt new file mode 100644 index 000000000..829686dd6 --- /dev/null +++ b/ext/dom/tests/DOMDocument_loadHTMLfile_variation2.phpt @@ -0,0 +1,17 @@ +--TEST-- +Test DOMDocument::loadHTMLFile when a not-well formed document is loaded +--DESCRIPTION-- +Verifies the behavior if a not-well formed document is loaded +--CREDITS-- +Antonio Diaz Ruiz <dejalatele@gmail.com> +--INI-- +assert.bail=true +--SKIPIF-- +<?php include('skipif.inc'); ?> +--FILE-- +<?php +$doc = new DOMDocument(); +$result = $doc->loadHTMLFile(dirname(__FILE__) . "/not_well.html"); +assert('$result === true'); +?> +--EXPECT-- diff --git a/ext/dom/tests/DOMNode_removeChild_basic.phpt b/ext/dom/tests/DOMNode_removeChild_basic.phpt index 384eb47b5..fb0977488 100644 --- a/ext/dom/tests/DOMNode_removeChild_basic.phpt +++ b/ext/dom/tests/DOMNode_removeChild_basic.phpt @@ -39,7 +39,7 @@ $root = $dom->documentElement; $children = $root->childNodes; $len = $children->length; -echo "orignal has $len nodes\n"; +echo "original has $len nodes\n"; for ($index = $children->length - 1; $index >=0; $index--) { echo "node $index\n"; $current = $children->item($index); @@ -58,7 +58,7 @@ for ($index = 0; $index < $children->length; $index++) { } --EXPECTF-- -orignal has 5 nodes +original has 5 nodes node 4 Course: no title:DOMText ~string(1) " diff --git a/ext/dom/tests/empty.html b/ext/dom/tests/empty.html new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/ext/dom/tests/empty.html diff --git a/ext/dom/tests/not_well.html b/ext/dom/tests/not_well.html new file mode 100644 index 000000000..151f46295 --- /dev/null +++ b/ext/dom/tests/not_well.html @@ -0,0 +1,8 @@ +<head> +<title>Hello world</title> +</head> +<body> +This is a not well-formed<br> +html files with undeclared entities +</body> +</html> |