com 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:
ext/dom/tests/DOMDocument_loadHTMLfile.phpt ext/dom/tests /DOMDocument_loadHTMLfile_error1.phpt ext/dom/tests/D OMDocument_loadHTMLfile_error2.phpt
ext/dom/tests/DOM Document

From: Date: Mon, 10 Jun 2013 08:50:00 +0000
Subject: com 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:
ext/dom/tests/DOMDocument_loadHTMLfile.phpt ext/dom/tests /DOMDocument_loadHTMLfile_error1.phpt ext/dom/tests/D OMDocument_loadHTMLfile_error2.phpt
ext/dom/tests/DOM Document
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-72350@lists.php.net to get a copy of this message
Commit: 8a8bef1b734884dfbad283747029b5946c1406d4 Author: Antonio Diaz Ruiz <dejalatele@gmail.com> Mon, 6 May 2013 23:01:18 +0200 Committer: Stanislav Malyshev <stas@php.net> Mon, 10 Jun 2013 01:50:00 -0700 Parents: f4e3c7ab7ccc393308cf1201290e0c4356596866 Branches: PHP-5.4 PHP-5.5 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8a8bef1b734884dfbad283747029b5946c1406d4 Log: 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 It also includes 2 auxilary files - An empty html file - A not well formed html file Changed paths: A ext/dom/tests/DOMDocument_loadHTMLfile.phpt A ext/dom/tests/DOMDocument_loadHTMLfile_error1.phpt A ext/dom/tests/DOMDocument_loadHTMLfile_error2.phpt A ext/dom/tests/DOMDocument_loadHTMLfile_variation1.phpt A ext/dom/tests/DOMDocument_loadHTMLfile_variation2.phpt A ext/dom/tests/empty.html A ext/dom/tests/not_well.html Diff: diff --git a/ext/dom/tests/DOMDocument_loadHTMLfile.phpt b/ext/dom/tests/DOMDocument_loadHTMLfile.phpt new file mode 100644 index 0000000..93a6149 --- /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 0000000..aee5196 --- /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 0000000..e59ff56 --- /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 0000000..2535772 --- /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 0000000..829686d --- /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 0000000..e69de29 diff --git a/ext/dom/tests/not_well.html b/ext/dom/tests/not_well.html new file mode 100644 index 0000000..151f462 --- /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>

« previous php.cvs (#72350) next »