mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-30 00:48:01 +00:00
ec4098c8fd
While we might never be able to have 100% of our code strict, we can at the very least do it for all of our tests. This ensures that our tests are using our API with the types as intended by the test author, and not silently be cast to what our API requires.
39 lines
1.5 KiB
PHP
39 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Reader\Html;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Reader\Html;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class Issue2942Test extends TestCase
|
|
{
|
|
public function testLoadFromString(): void
|
|
{
|
|
$content = '<table><tbody><tr><td>éàâèî</td></tr></tbody></table>';
|
|
$reader = new Html();
|
|
$spreadsheet = $reader->loadFromString($content);
|
|
$sheet = $spreadsheet->getActiveSheet();
|
|
self::assertSame('éàâèî', $sheet->getCell('A1')->getValue());
|
|
}
|
|
|
|
public function testLoadFromFile(): void
|
|
{
|
|
$file = 'tests/data/Reader/HTML/utf8chars.html';
|
|
$reader = new Html();
|
|
$spreadsheet = $reader->loadSpreadsheetFromFile($file);
|
|
$sheet = $spreadsheet->getActiveSheet();
|
|
self::assertSame('Test Utf-8 characters voilà', $sheet->getTitle());
|
|
self::assertSame('éàâèî', $sheet->getCell('A1')->getValue());
|
|
self::assertSame('αβγδε', $sheet->getCell('B1')->getValue());
|
|
self::assertSame('𐐁𐐂𐐃 & だけち', $sheet->getCell('A2')->getValue());
|
|
self::assertSame('אבגדה', $sheet->getCell('B2')->getValue());
|
|
self::assertSame('𪔀𪔁𪔂', $sheet->getCell('C2')->getValue());
|
|
self::assertSame('᠐᠑᠒', $sheet->getCell('A3')->getValue());
|
|
self::assertSame('അആ', $sheet->getCell('B3')->getValue());
|
|
self::assertSame('กขฃ', $sheet->getCell('C3')->getValue());
|
|
self::assertSame('✀✐✠', $sheet->getCell('D3')->getValue());
|
|
}
|
|
}
|