You are here

public function UnicodeTest::testConvertToUtf8 in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php \Drupal\Tests\Component\Utility\UnicodeTest::testConvertToUtf8()
  2. 9 core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php \Drupal\Tests\Component\Utility\UnicodeTest::testConvertToUtf8()

Tests UTF-8 conversion.

@dataProvider providerTestConvertToUtf8 @covers ::convertToUtf8

Parameters

string $data: The data to be converted.

string $encoding: The encoding the data is in.

string|bool $expected: The expected result.

File

core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php, line 293

Class

UnicodeTest
Test unicode handling features implemented in Unicode component.

Namespace

Drupal\Tests\Component\Utility

Code

public function testConvertToUtf8($data, $encoding, $expected) {
  $this
    ->assertEquals($expected, Unicode::convertToUtf8($data, $encoding));
}