Skip to content

Commit

Permalink
convert warnings to exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
bytestream committed Sep 19, 2021
1 parent 00f4293 commit af8c61f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/BaseTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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');
}

Expand Down
2 changes: 2 additions & 0 deletions tests/HTMLPurifier/HTMLModule/HTML5/LinkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

class HTMLPurifier_HTMLModule_HTML5_LinkTest extends BaseTestCase
{
protected $convertWarningsToExceptions = true;

protected function setUp()
{
parent::setUp();
Expand Down

0 comments on commit af8c61f

Please sign in to comment.