6343e226011f88c36aa5b8c31c051b4bf886d341.svn-base 722 B

123456789101112131415161718192021222324
  1. <?php
  2. // $Rev: 175 $
  3. error_reporting(E_ALL);
  4. function quick_test($html_dom, $str, $selector, $params=array('inner'=>'', 'plain'=>'', 'outer'=>'')) {
  5. $html_dom->load($str);
  6. $e = $html_dom->find($selector, 0);
  7. if (isset($params['inner']))
  8. assert($e->innertext===$params['inner']);
  9. if (isset($params['plain']))
  10. assert($e->plaintext===$params['plain']);
  11. if (isset($params['outer']))
  12. assert($e->outertext===$params['outer']);
  13. assert($html_dom==$str);
  14. }
  15. foreach (new DirectoryIterator(getcwd()) as $entry) {
  16. if ($entry->isFile() && strpos($entry, '_testcase.')>0) {
  17. echo basename($entry);
  18. require_once($entry);
  19. echo '<br>...pass!<br><br>';
  20. }
  21. }
  22. ?>