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());
} /**
* Tests the pattern validation.
*/
public function testMachineNameControllerWithInvalidReplacePattern() { $request = Request::
create('', 'GET',
['text' => 'Bob', 'langcode' => 'en', 'replace' => 'Alice', 'replace_pattern' => 'Bob', 'replace_token' => 'invalid'
]);
$this->
expectException(AccessDeniedHttpException::
class);
$this->
expectExceptionMessage("Invalid 'replace_token' query parameter."
);