You are here

protected function ContentTranslationSettingsTest::assertSettings in Drupal 9

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()

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

Parameters

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

string $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.

2 calls to ContentTranslationSettingsTest::assertSettings()
ContentTranslationSettingsTest::testFieldTranslatableSettingsUI in core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php
Tests that field setting depends on bundle translatability.
ContentTranslationSettingsTest::testSettingsUI in core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php
Tests that the settings UI works as expected.

File

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

Class

ContentTranslationSettingsTest
Tests the content translation settings UI.

Namespace

Drupal\Tests\content_translation\Functional

Code

protected function assertSettings($entity_type, $bundle, $enabled, $edit) {
  $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);
}