summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2013-06-10 12:59:28 +0400
committerDmitry Stogov <dmitry@zend.com>2013-06-10 12:59:28 +0400
commit53c39e2b4ed32b508763a4db18fd918ab0d036ca (patch)
tree6b83d60c688c311bb8faab4b215fc2f4872f1ed7
parentf68b8a5e7481686be1cdabf20f737f52dcb4299c (diff)
parent8a8bef1b734884dfbad283747029b5946c1406d4 (diff)
downloadphp-git-53c39e2b4ed32b508763a4db18fd918ab0d036ca.tar.gz
Merge branch 'PHP-5.4' of git.php.net:php-src into PHP-5.4
* 'PHP-5.4' of git.php.net:php-src: PHPTests for the DOMDocument::loadHTMLfile method. They cover - The basic behaviour - When the method receives as argument a file which doesn't exist - When the argument is an empty string - When an empty file is loaded - When a not-well formed html file is loaded Fix spelling and correct typo.
-rw-r--r--Zend/zend_gc.h4
-rw-r--r--ext/dom/tests/DOMDocument_loadHTMLfile.phpt17
-rw-r--r--ext/dom/tests/DOMDocument_loadHTMLfile_error1.phpt18
-rw-r--r--ext/dom/tests/DOMDocument_loadHTMLfile_error2.phpt18
-rw-r--r--ext/dom/tests/DOMDocument_loadHTMLfile_variation1.phpt18
-rw-r--r--ext/dom/tests/DOMDocument_loadHTMLfile_variation2.phpt17
-rw-r--r--ext/dom/tests/empty.html0
-rw-r--r--ext/dom/tests/not_well.html8
8 files changed, 98 insertions, 2 deletions
diff --git a/Zend/zend_gc.h b/Zend/zend_gc.h
index a443032686..3483e9dbf0 100644
--- a/Zend/zend_gc.h
+++ b/Zend/zend_gc.h
@@ -106,7 +106,7 @@ typedef struct _zend_gc_globals {
gc_root_buffer *first_unused; /* pointer to first unused buffer */
gc_root_buffer *last_unused; /* pointer to last unused buffer */
- zval_gc_info *zval_to_free; /* temporaryt list of zvals to free */
+ zval_gc_info *zval_to_free; /* temporary list of zvals to free */
zval_gc_info *free_list;
zval_gc_info *next_to_free;
@@ -199,7 +199,7 @@ static zend_always_inline void gc_remove_from_buffer(gc_root_buffer *root TSRMLS
GC_ZVAL_INIT(z); \
} while (0)
-/* The following macroses override macroses from zend_alloc.h */
+/* The following macros override macros from zend_alloc.h */
#undef ALLOC_ZVAL
#define ALLOC_ZVAL(z) \
do { \
diff --git a/ext/dom/tests/DOMDocument_loadHTMLfile.phpt b/ext/dom/tests/DOMDocument_loadHTMLfile.phpt
new file mode 100644
index 0000000000..93a614903f
--- /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 0000000000..aee51966a3
--- /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 0000000000..e59ff56c5a
--- /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 0000000000..2535772c78
--- /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 0000000000..829686dd65
--- /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/empty.html b/ext/dom/tests/empty.html
new file mode 100644
index 0000000000..e69de29bb2
--- /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 0000000000..151f46295f
--- /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&nbsp;
+</body>
+</html>