mirror of
https://github.com/danog/endtoend-test-psl.git
synced 2024-12-02 17:56:09 +01:00
d991adbc73
Co-authored-by: azjezz <azjezz@protonmail.com>
30 lines
581 B
PHP
30 lines
581 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Psl\Tests\Str;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use Psl\Str;
|
|
|
|
final class DetectEncodingTest extends TestCase
|
|
{
|
|
/**
|
|
* @dataProvider provideData
|
|
*/
|
|
public function testDetectEncoding(?string $expected, string $string): void
|
|
{
|
|
self::assertSame($expected, Str\detect_encoding($string));
|
|
}
|
|
|
|
public function provideData(): array
|
|
{
|
|
return [
|
|
['ASCII', 'hello'],
|
|
['UTF-8', 'سيف'],
|
|
['UTF-8', '🐘'],
|
|
[null, Str\Byte\chr(128)]
|
|
];
|
|
}
|
|
}
|