You are here

public function LingotekConfigBulkFormTest::testAssignInvalidJobIdsWithTMSUpdate in Lingotek Translation 3.4.x

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

Tests that we cannot assign job ids with invalid chars.

File

tests/src/Functional/Form/LingotekConfigBulkFormTest.php, line 630

Class

LingotekConfigBulkFormTest
Tests the config bulk management form.

Namespace

Drupal\Tests\lingotek\Functional\Form

Code

public function testAssignInvalidJobIdsWithTMSUpdate() {
  $assert_session = $this
    ->assertSession();
  $this
    ->goToConfigBulkManagementForm('node_type');

  // I can init the upload of content.
  $basepath = \Drupal::request()
    ->getBasePath();
  $assert_session
    ->linkByHrefExists($basepath . '/admin/lingotek/config/upload/node_type/article?destination=' . $basepath . '/admin/lingotek/config/manage');
  $assert_session
    ->linkByHrefExists($basepath . '/admin/lingotek/config/upload/node_type/page?destination=' . $basepath . '/admin/lingotek/config/manage');
  $this
    ->clickLink('EN');
  $edit = [
    'table[article]' => TRUE,
    'table[page]' => TRUE,
    $this
      ->getBulkOperationFormName() => $this
      ->getBulkOperationNameForAssignJobId('node_type'),
  ];
  $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'));
}