function ContentTranslationSettingsTest::assertSettings

Same name in other branches
  1. 9 core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php \Drupal\Tests\content_translation\Functional\ContentTranslationSettingsTest::assertSettings()
  2. 8.9.x core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php \Drupal\Tests\content_translation\Functional\ContentTranslationSettingsTest::assertSettings()
  3. 10 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.

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 281

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');
    $status = $enabled ? 'enabled' : 'disabled';
    $message = "Translation for entity {$entity_type} ({$bundle}) is {$status}.";
    $this->assertEquals($enabled, \Drupal::service('content_translation.manager')->isEnabled($entity_type, $bundle), $message);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.