You are here

public function LingotekNodeBulkProfileTest::testChangeTranslationProfileBulkAfterCancelling in Lingotek Translation 8.2

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

Tests that the translation profiles can be updated with the bulk actions after cancelling.

File

tests/src/Functional/LingotekNodeBulkProfileTest.php, line 391

Class

LingotekNodeBulkProfileTest
Tests changing a profile using the bulk management form.

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testChangeTranslationProfileBulkAfterCancelling() {

  // Login as admin.
  $this
    ->drupalLogin($this->rootUser);

  // Create three nodes.
  $nodes = [];
  for ($i = 1; $i < 4; $i++) {
    $edit = [];
    $edit['title[0][value]'] = 'Llamas are cool ' . $i;
    $edit['body[0][value]'] = 'Llamas are very cool ' . $i;
    $edit['langcode[0][value]'] = 'en';
    $edit['lingotek_translation_management[lingotek_translation_profile]'] = 'manual';
    $this
      ->saveAndPublishNodeForm($edit);
    $nodes[$i] = $edit;
  }
  $this
    ->goToContentBulkManagementForm();

  // I can init the upload of content.
  $this
    ->assertLingotekUploadLink(1);
  $this
    ->assertLingotekUploadLink(2);
  $this
    ->assertLingotekUploadLink(3);
  $key = $this
    ->getBulkSelectionKey('en', 1);
  $edit = [
    $key => TRUE,
    'table[2]' => TRUE,
    'table[3]' => TRUE,
    $this
      ->getBulkOperationFormName() => $this
      ->getBulkOperationNameForCancel('node'),
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());
  $key = $this
    ->getBulkSelectionKey('en', 1);
  $edit = [
    $key => TRUE,
    'table[2]' => TRUE,
    'table[3]' => TRUE,
    $this
      ->getBulkOperationFormName() => 'change_profile:automatic',
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());

  // Check that there are three nodes with the Automatic Profile
  $automatic_profile = $this
    ->xpath("//td[contains(text(), 'Automatic')]");
  $this
    ->assertEqual(count($automatic_profile), 3, 'There are three nodes with the Automatic Profile set.');
}