You are here

protected function ContentTranslationSettingsTest::assertSettings in Drupal 8

Same name and namespace in other branches
  1. 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.

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.

Return value

bool TRUE if the assertion succeeded, FALSE otherwise.

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 261

Class

ContentTranslationSettingsTest
Tests the content translation settings UI.

Namespace

Drupal\Tests\content_translation\Functional

Code

protected function assertSettings($entity_type, $bundle, $enabled, $edit) {
  $this
    ->drupalPostForm('admin/config/regional/content-language', $edit, t('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);
  return $this
    ->assertEqual(\Drupal::service('content_translation.manager')
    ->isEnabled($entity_type, $bundle), $enabled, $message);
}