mirror of
https://github.com/php/php-src.git
synced 2024-12-24 09:18:17 +08:00
Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4: 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
This commit is contained in:
commit
7a2d9690fe
17
ext/dom/tests/DOMDocument_loadHTMLfile.phpt
Normal file
17
ext/dom/tests/DOMDocument_loadHTMLfile.phpt
Normal file
@ -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--
|
18
ext/dom/tests/DOMDocument_loadHTMLfile_error1.phpt
Normal file
18
ext/dom/tests/DOMDocument_loadHTMLfile_error1.phpt
Normal file
@ -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
|
18
ext/dom/tests/DOMDocument_loadHTMLfile_error2.phpt
Normal file
18
ext/dom/tests/DOMDocument_loadHTMLfile_error2.phpt
Normal file
@ -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
|
18
ext/dom/tests/DOMDocument_loadHTMLfile_variation1.phpt
Normal file
18
ext/dom/tests/DOMDocument_loadHTMLfile_variation1.phpt
Normal file
@ -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
|
17
ext/dom/tests/DOMDocument_loadHTMLfile_variation2.phpt
Normal file
17
ext/dom/tests/DOMDocument_loadHTMLfile_variation2.phpt
Normal file
@ -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--
|
0
ext/dom/tests/empty.html
Normal file
0
ext/dom/tests/empty.html
Normal file
8
ext/dom/tests/not_well.html
Normal file
8
ext/dom/tests/not_well.html
Normal file
@ -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>
|
Loading…
Reference in New Issue
Block a user