You are here

public function LingotekNodeParagraphsTranslationTest::testBulkManagementParagraphsIgnoreFilterByLabel in Lingotek Translation 3.4.x

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

Paragraphs don't have a title, so we ignore a label filter if it exists.

File

tests/src/Functional/LingotekNodeParagraphsTranslationTest.php, line 228

Class

LingotekNodeParagraphsTranslationTest
Tests translating a node with multiple locales including paragraphs.

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testBulkManagementParagraphsIgnoreFilterByLabel() {

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

  // Add paragraphed content.
  $this
    ->drupalGet('node/add/paragraphed_content_demo');
  $this
    ->drupalPostForm(NULL, NULL, t('Add Image + Text'));
  $this
    ->drupalPostForm(NULL, NULL, t('Add Image + Text'));
  $edit = [];
  $edit['title[0][value]'] = 'Llamas are cool';
  $edit['langcode[0][value]'] = 'en';
  $edit['field_paragraphs_demo[0][subform][field_text_demo][0][value]'] = 'Llamas are very cool for the first time';
  $edit['field_paragraphs_demo[1][subform][field_text_demo][0][value]'] = 'Llamas are very cool for the second time';
  $edit['moderation_state[0][state]'] = 'published';
  $this
    ->drupalPostForm(NULL, $edit, t('Save'));

  // Ensure paragraphs tab is enabled.
  $this
    ->drupalPostForm('admin/lingotek/settings', [
    'contrib[paragraphs][enable_bulk_management]' => 1,
  ], 'Save settings', [], 'lingoteksettings-integrations-form');
  $this
    ->goToContentBulkManagementForm('paragraph');

  // Assert there is at least one paragraph in the list.
  $this
    ->assertText('Image + Text');

  // Set a filter, and there should still be paragraphs.

  /** @var \Drupal\user\PrivateTempStore $tempStore */
  $tempStore = \Drupal::service('tempstore.private')
    ->get('lingotek.management.filter.paragraph');
  $tempStore
    ->set('label', 'Llamas');
  $this
    ->goToContentBulkManagementForm('paragraph');
  $this
    ->assertText('Image + Text');
}