You are here

protected function ContentTranslationSettingsTest::assertSettings in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php \Drupal\Tests\content_translation\Functional\ContentTranslationSettingsTest::assertSettings()
  2. 9 core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php \Drupal\Tests\content_translation\Functional\ContentTranslationSettingsTest::assertSettings()

Asserts that translatability has the expected value for the given bundle.

@internal

Parameters

string $entity_type: The entity type for which to check translatability.

string|null $bundle: The bundle for which to check translatability.

bool $enabled: TRUE if translatability should be enabled, FALSE otherwise.

array $edit: An array of values to submit to the content translation settings page.

File

core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php, line 275

Class

ContentTranslationSettingsTest
Tests the content translation settings UI.

Namespace

Drupal\Tests\content_translation\Functional

Code

protected function assertSettings(string $entity_type, ?string $bundle, bool $enabled, array $edit) : void {
  $this
    ->drupalGet('admin/config/regional/content-language');
  $this
    ->submitForm($edit, 'Save configuration');
  $args = [
    '@entity_type' => $entity_type,
    '@bundle' => $bundle,
    '@enabled' => $enabled ? 'enabled' : 'disabled',
  ];
  $message = new FormattableMarkup('Translation for entity @entity_type (@bundle) is @enabled.', $args);
  $this
    ->assertEquals($enabled, \Drupal::service('content_translation.manager')
    ->isEnabled($entity_type, $bundle), $message);
}