$language_manager =
$this->
prophesize(LanguageManagerInterface::
class);
$language_manager->
getCurrentLanguage()->
willReturn($language);
$csrf_token =
$this->
prophesize(CsrfTokenGenerator::
class);
$csrf_token->
get('[^a-z0-9_]+'
)->
willReturn('tis-a-fine-token'
);
$container =
$this->
prophesize(ContainerInterface::
class);
$container->
get('language_manager'
)->
willReturn($language_manager->
reveal());
$container->
get('csrf_token'
)->
willReturn($csrf_token->
reveal());
\Drupal::
setContainer($container->
reveal());
$element = MachineName::
processMachineName($element,
$form_state,
$complete_form);
$settings =
$element['#attached'
]['drupalSettings'
]['machineName'
]['#source'
];
$allowed_options =
[ 'replace_pattern',
'replace',
'maxlength',
'target',
'label',
'field_prefix',
'field_suffix',
'suffix',