From af8c61fc4dda12f7f58834f7aa043e98daceca22 Mon Sep 17 00:00:00 2001 From: Kieran Brahney Date: Sun, 19 Sep 2021 17:02:46 +0100 Subject: [PATCH] convert warnings to exceptions --- tests/BaseTestCase.php | 9 +++++++++ tests/HTMLPurifier/HTMLModule/HTML5/LinkTest.php | 2 ++ 2 files changed, 11 insertions(+) diff --git a/tests/BaseTestCase.php b/tests/BaseTestCase.php index 42a0555..5aabd72 100644 --- a/tests/BaseTestCase.php +++ b/tests/BaseTestCase.php @@ -22,6 +22,11 @@ class BaseTestCase extends PHPUnit_Framework_TestCase */ private $errors; + /** + * @var bool + */ + protected $convertWarningsToExceptions = false; + protected function setUp() { $this->config = HTMLPurifier_HTML5Config::create(null); @@ -41,6 +46,10 @@ protected function setUp() */ public function errorHandler($errno, $message) { + if ($this->convertWarningsToExceptions) { + throw new RuntimeException(sprintf('[%s] %s', $errno, $message)); + } + $this->errors[] = compact('errno', 'message'); } diff --git a/tests/HTMLPurifier/HTMLModule/HTML5/LinkTest.php b/tests/HTMLPurifier/HTMLModule/HTML5/LinkTest.php index 5f6484e..580e6d7 100644 --- a/tests/HTMLPurifier/HTMLModule/HTML5/LinkTest.php +++ b/tests/HTMLPurifier/HTMLModule/HTML5/LinkTest.php @@ -2,6 +2,8 @@ class HTMLPurifier_HTMLModule_HTML5_LinkTest extends BaseTestCase { + protected $convertWarningsToExceptions = true; + protected function setUp() { parent::setUp();