. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Tests\Encodings; use Fisharebest\Webtrees\Encodings\CP850; use Fisharebest\Webtrees\Encodings\UTF8; use PHPUnit\Framework\TestCase; use function chr; use function iconv; /** * Tests for class CP850. */ class CP850Test extends TestCase { /** * @covers \Fisharebest\Webtrees\Encodings\AbstractEncoding * @covers \Fisharebest\Webtrees\Encodings\CP850 * * @return void */ public function testToUtf8(): void { $encoding = new CP850(); foreach (range(0, 255) as $code_point) { $character = chr($code_point); $actual = $encoding->toUtf8($character); $expected = iconv(CP850::NAME, UTF8::NAME, $character); static::assertSame($expected, $actual, dechex($code_point) . '=>' . $actual . ' ' . $expected); } } }