mirror of
https://github.com/danog/endtoend-test-psl.git
synced 2024-12-02 17:56:09 +01:00
35 lines
1007 B
PHP
35 lines
1007 B
PHP
|
<?php
|
||
|
|
||
|
declare(strict_types=1);
|
||
|
|
||
|
namespace Psl\Tests\Html;
|
||
|
|
||
|
use PHPUnit\Framework\TestCase;
|
||
|
use Psl\Html;
|
||
|
|
||
|
final class DecodeTest extends TestCase
|
||
|
{
|
||
|
/**
|
||
|
* @dataProvider provideData
|
||
|
*/
|
||
|
public function testEncode(string $expected, string $html, ?string $encoding): void
|
||
|
{
|
||
|
static::assertSame($expected, Html\decode($html, $encoding));
|
||
|
}
|
||
|
|
||
|
public function provideData(): iterable
|
||
|
{
|
||
|
yield ['hello', 'hello', 'UTF-8'];
|
||
|
yield ['héllo', 'héllo', 'UTF-8'];
|
||
|
yield ['<hello />', '<hello />', 'UTF-8'];
|
||
|
yield ['<p>Hello</p>', '<p>Hello</p>', 'UTF-8'];
|
||
|
yield ['<p>< </p>', '<p>&lt; </p>', 'UTF-8'];
|
||
|
|
||
|
yield ['hello', 'hello', 'UTF-8'];
|
||
|
yield ['héllo', 'héllo', 'UTF-8'];
|
||
|
yield ['<hello />', '<hello />', 'UTF-8'];
|
||
|
yield ['<p>Hello</p>', '<p>Hello</p>', 'UTF-8'];
|
||
|
yield ['<p>< </p>', '<p>< </p>', 'UTF-8'];
|
||
|
}
|
||
|
}
|