From 8e38d459e5946d51c16bce3355ec5393143c8824 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Tue, 15 Dec 2009 05:22:05 +0000 Subject: #653940 follow-up by Damien Tournoud: Clean-up of error handling from first stab at test reporting fixes. --- modules/simpletest/drupal_web_test_case.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'modules/simpletest/drupal_web_test_case.php') diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php index 3c4a2396c..1946e5dc3 100644 --- a/modules/simpletest/drupal_web_test_case.php +++ b/modules/simpletest/drupal_web_test_case.php @@ -1387,16 +1387,14 @@ class DrupalWebTestCase extends DrupalTestCase { */ protected function parse() { if (!$this->elements) { - // Suppress all libxml warnings during loading of HTML. - // @todo Remove this when core produces XHTML valid output. - libxml_use_internal_errors(TRUE); - $document = new DOMDocument(); - $result = $document->loadHTML($this->content); - if ($result) { + // DOM can load HTML soup. But, HTML soup can throw warnings, suppress + // them. + @$htmlDom = DOMDocument::loadHTML($this->content); + if ($htmlDom) { $this->pass(t('Valid HTML found on "@path"', array('@path' => $this->getUrl())), t('Browser')); // It's much easier to work with simplexml than DOM, luckily enough // we can just simply import our DOM tree. - $this->elements = simplexml_import_dom($document); + $this->elements = simplexml_import_dom($htmlDom); } } if (!$this->elements) { -- cgit v1.2.3