You are here

public function LingotekNodeManageTranslationTabTest::testNodeTranslationMessageWhenBundleNotTranslatable in Lingotek Translation 4.0.x

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

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

File

tests/src/Functional/LingotekNodeManageTranslationTabTest.php, line 227

Class

LingotekNodeManageTranslationTabTest
Tests translating a node using the bulk management form.

Namespace

Drupal\Tests\lingotek\Functional

Code

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

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

  // Create a node.
  $edit = [];
  $edit['title[0][value]'] = 'Pages are cool';
  $edit['body[0][value]'] = 'Pages are very cool';
  $this
    ->drupalPostForm('node/add/page', $edit, t('Save'));

  // Check that the manage translations tab is in the node.
  $this
    ->drupalGet('node/1');
  $this
    ->clickLink('Manage Translations');
  $assert_session
    ->pageTextContains('Not enabled');
  $this
    ->clickLink('EN');
  $assert_session
    ->pageTextContains('Cannot upload Page Pages are cool. That Content type is not enabled for translation.');
  $edit = [
    'table[node:1]' => TRUE,
    $this
      ->getBulkOperationFormName() => $this
      ->getBulkOperationNameForUpload('node'),
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());
  $this
    ->assertIdentical(NULL, \Drupal::state()
    ->get('lingotek.uploaded_locale'));
  $assert_session
    ->pageTextContains('Cannot upload Page Pages are cool. That Content type is not enabled for translation.');
}