public function testSelectionSettingsHandling() { $entity_reference_controller = EntityAutocompleteController::
create($this->container
);
$request = Request::
create('entity_reference_autocomplete/' .
$this->entityType . '/default'
);
$request->query->
set('q',
$this->
randomString());
try { // Pass an invalid selection settings key (i.e. one that does not exist
// in the key/value store).
$selection_settings_key =
$this->
randomString();
$entity_reference_controller->
handleAutocomplete($request,
$this->entityType, 'default',
$selection_settings_key);
$this->
fail('Non-existent selection settings key throws an exception.'
);
} catch (AccessDeniedHttpException
$e) { // Expected exception; just continue testing.
} try { // Generate a valid hash key but store a modified settings array.
$selection_settings =
[];
$selection_settings_key = Crypt::
hmacBase64(serialize($selection_settings) .
$this->entityType . 'default', Settings::
getHashSalt());