File: EncodingTest.php

package info (click to toggle)
php-lorenzo-pinky 1.1.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 216 kB
  • sloc: php: 872; makefile: 10
file content (34 lines) | stat: -rw-r--r-- 1,024 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;

use function Pinky\transformString;

class EncodingTest extends TestCase
{
    /**
     * @param string $expected
     * @param string $input
     */
    #[DataProvider('provideStrings')]
    public function testMultiByteContent($expected, $input)
    {
        $this->assertEquals($expected, trim(transformString($input)->saveHTML()));
    }

    public static function provideStrings()
    {
        yield [
            '<html><body><p>ASCII only</p></body></html>',
            '<p>ASCII only</p>',
        ];
        yield [
            '<html><body><p>Twoje zam&oacute;wienie oczekuje na wp&#322;at&#281; zadatku &#127475;&#127473;</p></body></html>',
            '<p>Twoje zamówienie oczekuje na wpłatę zadatku 🇳🇱</p>',
        ];
        yield [
            '<html><body><p>&#1055;&#1088;&#1080;&#1074;&#1077;&#1090; &#1084;&#1080;&#1088;!</p></body></html>',
            '<p>Привет мир!</p>',
        ];
    }
}