function UnicodeTest::testConvertToUtf8

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php \Drupal\Tests\Component\Utility\UnicodeTest::testConvertToUtf8()
  2. 10 core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php \Drupal\Tests\Component\Utility\UnicodeTest::testConvertToUtf8()
  3. 11.x 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 495

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));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.