You are here

public function MachineNameControllerTest::testMachineNameController in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/tests/src/Unit/Transliteration/MachineNameControllerTest.php \Drupal\Tests\system\Unit\Transliteration\MachineNameControllerTest::testMachineNameController()
  2. 9 core/modules/system/tests/src/Unit/Transliteration/MachineNameControllerTest.php \Drupal\Tests\system\Unit\Transliteration\MachineNameControllerTest::testMachineNameController()

Tests machine name controller's transliteration functionality.

@dataProvider providerTestMachineNameController

Parameters

array $request_params: An array of request parameters.

$expected_content: The expected content of the JSONresponse.

See also

\Drupal\system\MachineNameController::transliterate()

File

core/modules/system/tests/src/Unit/Transliteration/MachineNameControllerTest.php, line 97

Class

MachineNameControllerTest
Tests that the machine name controller can transliterate strings as expected.

Namespace

Drupal\Tests\system\Unit\Transliteration

Code

public function testMachineNameController(array $request_params, $expected_content) {
  $request = Request::create('', 'GET', $request_params);
  $json = $this->machineNameController
    ->transliterate($request);
  $this
    ->assertEquals($expected_content, $json
    ->getContent());
}