mirror of
https://github.com/j0k3r/php-readability.git
synced 2026-09-27 06:26:17 +00:00
tests: Fix “THE ERROR HANDLER HAS CHANGED!”
(cherry picked from commit 23f824a1ce)
This commit is contained in:
@@ -332,10 +332,11 @@ class ReadabilityTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
public function testAutoClosingIframeNotThrowingException()
|
||||
{
|
||||
error_reporting(\E_ALL | \E_STRICT);
|
||||
ini_set('display_errors', true);
|
||||
$oldErrorReporting = error_reporting(\E_ALL | \E_STRICT);
|
||||
$oldDisplayErrors = ini_set('display_errors', true);
|
||||
set_error_handler([$this, 'error2Exception'], \E_ALL | \E_STRICT);
|
||||
|
||||
try {
|
||||
$data = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="ru-RU" prefix="og: http://ogp.me/ns#">
|
||||
|
||||
@@ -358,6 +359,8 @@ class ReadabilityTest extends \PHPUnit\Framework\TestCase
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>';
|
||||
|
||||
@@ -371,6 +374,13 @@ class ReadabilityTest extends \PHPUnit\Framework\TestCase
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertStringContainsString('<iframe src="https://www.youtube.com/embed/PUep6xNeKjA" width="560" height="315" frameborder="0" allowfullscreen="allowfullscreen"> </iframe>', $readability->getContent()->getInnerHtml());
|
||||
$this->assertStringContainsString('3D Touch', $readability->getTitle()->getInnerHtml());
|
||||
} finally {
|
||||
restore_error_handler();
|
||||
if (false !== $oldDisplayErrors) {
|
||||
ini_set('display_errors', $oldDisplayErrors);
|
||||
}
|
||||
error_reporting($oldErrorReporting);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user