mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-10-08 12:56:39 +00:00
2c8177a319
The tests stay; they just no longer run in separate processes. I think that only 2 tests still require separate processes - Helper/SampleTest and Tcpdf/NoDieTest. Aside from a new internal method in IOFactory, all the changes here are to test members.
44 lines
1.0 KiB
PHP
44 lines
1.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Reader\Html;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Reader\Html;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
/**
|
|
* Dom loadHtml usually succeeds even with invalid Html,
|
|
* although it will generate warning messages.
|
|
* This member demonstrates a method less intrusive than
|
|
* set_error_handler to detect if there has been a problem.
|
|
*/
|
|
class HtmlLibxmlTest extends TestCase
|
|
{
|
|
private bool $useErrors;
|
|
|
|
protected function setUp(): void
|
|
{
|
|
$this->useErrors = libxml_use_internal_errors(true);
|
|
}
|
|
|
|
protected function tearDown(): void
|
|
{
|
|
libxml_use_internal_errors($this->useErrors);
|
|
}
|
|
|
|
public function testLoadInvalidString(): void
|
|
{
|
|
$html = '<table<>';
|
|
(new Html())->loadFromString($html);
|
|
self::assertNotEmpty(libxml_get_errors());
|
|
}
|
|
|
|
public function testLoadValidString(): void
|
|
{
|
|
$html = '<table>';
|
|
(new Html())->loadFromString($html);
|
|
self::assertEmpty(libxml_get_errors());
|
|
}
|
|
}
|