You are here

public function LingotekNodeParagraphsSettingsTest::testDisablingContentTranslationDoesntDisableLingotekTranslationForParagraphs in Lingotek Translation 3.8.x

Same name and namespace in other branches
  1. 4.0.x tests/src/Functional/LingotekNodeParagraphsSettingsTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeParagraphsSettingsTest::testDisablingContentTranslationDoesntDisableLingotekTranslationForParagraphs()

Tests that disabling content translation doesn't change lingotek translation settings for paragraphs.

File

tests/src/Functional/LingotekNodeParagraphsSettingsTest.php, line 83

Class

LingotekNodeParagraphsSettingsTest
Tests unsetting translatability in paragraphs does not disable Lingotek.

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testDisablingContentTranslationDoesntDisableLingotekTranslationForParagraphs() {
  $this
    ->drupalGet('admin/lingotek/settings');
  $this
    ->assertFieldByName('node[paragraphed_content_demo][fields][field_paragraphs_demo]', TRUE);
  $this
    ->assertFieldByName('paragraph[image_text][fields][field_text_demo]', TRUE);
  $edit = [];
  $edit['settings[node][paragraphed_content_demo][fields][field_paragraphs_demo]'] = FALSE;
  $edit['settings[paragraph][image_text][fields][field_text_demo]'] = FALSE;
  $this
    ->drupalPostForm('/admin/config/regional/content-language', $edit, 'Save configuration');
  $this
    ->assertSession()
    ->responseContains('Settings successfully updated.');
  $this
    ->drupalGet('admin/lingotek/settings');

  // The paragraph is still enabled.
  $this
    ->assertFieldByName('node[paragraphed_content_demo][fields][field_paragraphs_demo]', TRUE);

  // The text field was disabled, and it's not even present.

  /** @var \Drupal\lingotek\LingotekConfigurationServiceInterface $lingotekConfig */
  $lingotekConfig = \Drupal::service('lingotek.configuration');
  $this
    ->assertFalse($lingotekConfig
    ->isFieldLingotekEnabled('paragraph', 'image_text', 'field_text_demo'));
  $this
    ->assertNoFieldByName('paragraph[image_text][fields][field_text_demo]');
}