Problem/Motivation
Various functional tests in node module use form submission to perform setup. E.g., in NodeFieldMultilingualTest::setUp():
// Enable URL language detection and selection.
$edit = ['language_interface[enabled][language-url]' => '1'];
$this->drupalPostForm('admin/config/regional/language/detection', $edit, t('Save settings'));
// Set "Basic page" content type to use multilingual support.
$edit = [
'language_configuration[language_alterable]' => TRUE,
];
$this->drupalPostForm('admin/structure/types/manage/page', $edit, t('Save content type'));
$this->assertRaw(t('The content type %type has been updated.', ['%type' => 'Basic page']), 'Basic page content type has been updated.');
This makes the test slower, because form submissions in the test browser take longer than API calls.
Replacing this with API calls will make the test faster to run, and easier to read.
Proposed resolution
Replace with API calls.
From what I can tell, what's needed is something like this:
$config = $this->config('language.negotiation');
$config->set('url.prefixes', [
'en' => 'en',
'de' => 'de',
])->save();
$this->container->get('entity_type.manager')->getStorage('language_content_settings')->create([
'target_entity_type_id' => $entity_type,
'target_bundle' => $bundle,
])->save();