/home/mjc1/public_html/lib/html_dom/testcase/all_test.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
// $Rev: 175 $
error_reporting(E_ALL);

function 
quick_test($html_dom$str$selector$params=array('inner'=>'''plain'=>'''outer'=>'')) {
    
$html_dom->load($str);
    
$e $html_dom->find($selector0);
    if (isset(
$params['inner']))
        
assert($e->innertext===$params['inner']);
    if (isset(
$params['plain']))
        
assert($e->plaintext===$params['plain']);
    if (isset(
$params['outer']))
        
assert($e->outertext===$params['outer']);
    
assert($html_dom==$str);
}

foreach (new 
DirectoryIterator(getcwd()) as $entry) {
    if (
$entry->isFile() && strpos($entry'_testcase.')>0) {
        echo 
basename($entry);
        require_once(
$entry);
        echo 
'<br>...pass!<br><br>';
    }
}
?>