You are here

protected function ContentTranslationSettingsTest::assertSettings in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/content_translation/src/Tests/ContentTranslationSettingsTest.php \Drupal\content_translation\Tests\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/src/Tests/ContentTranslationSettingsTest.php
Tests that field setting depends on bundle translatability.
ContentTranslationSettingsTest::testSettingsUI in core/modules/content_translation/src/Tests/ContentTranslationSettingsTest.php
Tests that the settings UI works as expected.

File

core/modules/content_translation/src/Tests/ContentTranslationSettingsTest.php, line 242
Contains \Drupal\content_translation\Tests\ContentTranslationSettingsTest.

Class

ContentTranslationSettingsTest
Tests the content translation settings UI.

Namespace

Drupal\content_translation\Tests

Code

protected function assertSettings($entity_type, $bundle, $enabled, $edit) {
  $this
    ->drupalPostForm('admin/config/regional/content-language', $edit, t('Save configuration'));
  $args = array(
    '@entity_type' => $entity_type,
    '@bundle' => $bundle,
    '@enabled' => $enabled ? 'enabled' : 'disabled',
  );
  $message = format_string('Translation for entity @entity_type (@bundle) is @enabled.', $args);
  \Drupal::entityManager()
    ->clearCachedDefinitions();
  return $this
    ->assertEqual(\Drupal::service('content_translation.manager')
    ->isEnabled($entity_type, $bundle), $enabled, $message);
}