You are here

public function LingotekNodeManageTranslationTabTest::testAssignInvalidJobIdsWithTMSUpdate in Lingotek Translation 8.2

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

Tests that we cannot assign job ids with invalid chars.

File

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

Class

LingotekNodeManageTranslationTabTest
Tests translating a node using the bulk management form.

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testAssignInvalidJobIdsWithTMSUpdate() {

  // Create a couple of content.
  $edit = [];
  $edit['title[0][value]'] = 'Llamas are cool';
  $edit['body[0][value]'] = 'Llamas are very cool';
  $edit['langcode[0][value]'] = 'en';
  $edit['field_tags[target_id]'] = implode(',', [
    'Camelid',
    'Herbivorous',
  ]);
  $edit['lingotek_translation_management[lingotek_translation_profile]'] = 'manual';
  $this
    ->saveAndPublishNodeForm($edit);
  $this
    ->goToContentBulkManagementForm();

  // I can init the upload of content.
  $this
    ->assertLingotekUploadLink(1, 'node');
  $this
    ->assertLingotekUploadLink(1, 'taxonomy_term', NULL, 'node');
  $this
    ->clickLink('EN');
  $edit = [
    'table[node:1]' => TRUE,
    'table[taxonomy_term:1]' => TRUE,
    $this
      ->getBulkOperationFormName() => $this
      ->getBulkOperationNameForAssignJobId('node'),
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());
  $edit = [
    'job_id' => 'my\\invalid\\id',
    'update_tms' => 1,
  ];
  $this
    ->drupalPostForm(NULL, $edit, 'Assign Job ID');
  $this
    ->assertText('The job ID name cannot contain invalid chars as "/" or "\\".');

  // There is no update, because it's not valid.
  $this
    ->assertNull(\Drupal::state()
    ->get('lingotek.uploaded_job_id'));
  $edit = [
    'job_id' => 'my/invalid/id',
    'update_tms' => 1,
  ];
  $this
    ->drupalPostForm(NULL, $edit, 'Assign Job ID');
  $this
    ->assertText('The job ID name cannot contain invalid chars as "/" or "\\".');

  // There is no update, because it's not valid.
  $this
    ->assertNull(\Drupal::state()
    ->get('lingotek.uploaded_job_id'));
}