You are here

public function LingotekNodeBulkTranslationTest::testNodeTranslationMessageWhenBundleNotConfiguredWithLinks in Lingotek Translation 3.6.x

Same name and namespace in other branches
  1. 4.0.x tests/src/Functional/LingotekNodeBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeBulkTranslationTest::testNodeTranslationMessageWhenBundleNotConfiguredWithLinks()
  2. 3.2.x tests/src/Functional/LingotekNodeBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeBulkTranslationTest::testNodeTranslationMessageWhenBundleNotConfiguredWithLinks()
  3. 3.3.x tests/src/Functional/LingotekNodeBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeBulkTranslationTest::testNodeTranslationMessageWhenBundleNotConfiguredWithLinks()
  4. 3.4.x tests/src/Functional/LingotekNodeBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeBulkTranslationTest::testNodeTranslationMessageWhenBundleNotConfiguredWithLinks()
  5. 3.5.x tests/src/Functional/LingotekNodeBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeBulkTranslationTest::testNodeTranslationMessageWhenBundleNotConfiguredWithLinks()
  6. 3.7.x tests/src/Functional/LingotekNodeBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeBulkTranslationTest::testNodeTranslationMessageWhenBundleNotConfiguredWithLinks()
  7. 3.8.x tests/src/Functional/LingotekNodeBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeBulkTranslationTest::testNodeTranslationMessageWhenBundleNotConfiguredWithLinks()

Tests that a node cannot be translated if not configured, and will provide user-friendly messages.

1 method overrides LingotekNodeBulkTranslationTest::testNodeTranslationMessageWhenBundleNotConfiguredWithLinks()
LingotekNodeBulkViewsTranslationTest::testNodeTranslationMessageWhenBundleNotConfiguredWithLinks in tests/src/Functional/Views/LingotekNodeBulkViewsTranslationTest.php
Tests that a node cannot be translated if not configured, and will provide user-friendly messages.

File

tests/src/Functional/LingotekNodeBulkTranslationTest.php, line 128

Class

LingotekNodeBulkTranslationTest
Tests translating a node using the bulk management form.

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testNodeTranslationMessageWhenBundleNotConfiguredWithLinks() {
  $assert_session = $this
    ->assertSession();

  // Create Article node types.
  $this
    ->drupalCreateContentType([
    'type' => 'page',
    'name' => 'Page',
  ]);

  // Enable translation for the current entity type and ensure the change is
  // picked up.
  ContentLanguageSettings::loadByEntityTypeBundle('node', 'page')
    ->setLanguageAlterable(TRUE)
    ->save();
  \Drupal::service('content_translation.manager')
    ->setEnabled('node', 'page', TRUE);

  // Create a node.
  $edit = [];
  $edit['title[0][value]'] = 'Pages are cool';
  $edit['body[0][value]'] = 'Pages are very cool';
  $edit['langcode[0][value]'] = 'en';
  $this
    ->drupalPostForm('node/add/page', $edit, t('Save'));
  $this
    ->goToContentBulkManagementForm();
  $assert_session
    ->pageTextContains('Not enabled');
  $this
    ->clickLink('EN');
  $assert_session
    ->pageTextContains('Cannot upload Page Pages are cool. That Content type is not enabled for Lingotek translation.');
}