function MachineNameControllerTest::testMachineNameController

Same name in other branches
  1. 9 core/modules/system/tests/src/Unit/Transliteration/MachineNameControllerTest.php \Drupal\Tests\system\Unit\Transliteration\MachineNameControllerTest::testMachineNameController()
  2. 8.9.x 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 102

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) : void {
    $request = Request::create('', 'GET', $request_params);
    $json = $this->machineNameController
        ->transliterate($request);
    $this->assertEquals($expected_content, $json->getContent());
}

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