You are here

public function LingotekNodeBulkFormTest::testBulkPager in Lingotek Translation 3.1.x

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

Tests that the bulk management pager works correctly.

File

tests/src/Functional/Form/LingotekNodeBulkFormTest.php, line 69

Class

LingotekNodeBulkFormTest
Tests the bulk management form.

Namespace

Drupal\Tests\lingotek\Functional\Form

Code

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

  // Login as admin.
  $this
    ->drupalLogin($this->rootUser);
  $nodes = [];

  // Create a node.
  for ($i = 1; $i < 15; $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();

  // Navigate to page 2.
  $this
    ->clickLink(t('Page 2'));
  $this
    ->assertUrl('admin/lingotek/manage/node?page=1');

  // I can init the upload of content.
  $this
    ->assertLingotekUploadLink(11, 'node');
  $this
    ->assertLingotekUploadLink(12, 'node');
  $key1 = $this
    ->getBulkSelectionKey('en', 11);
  $key2 = $this
    ->getBulkSelectionKey('en', 12);
  $edit = [
    // Node 11.
    $key1 => TRUE,
    // Node 12.
    $key2 => TRUE,
    $this
      ->getBulkOperationFormName() => $this
      ->getBulkOperationNameForUpload('node'),
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());

  // The current page is kept.
  $this
    ->assertUrl('admin/lingotek/manage/node?page=1');

  // There is a link for checking status.
  $this
    ->assertLingotekCheckSourceStatusLink();

  // And we can already request a translation.
  $this
    ->assertLingotekRequestTranslationLink('es_MX');
  $this
    ->clickLink('EN');
  $this
    ->assertText('The import for node Llamas are cool 11 is complete.');

  // The current page is kept.
  $this
    ->assertUrl('admin/lingotek/manage/node?page=1');
}