You are here

public function LingotekNodeParagraphsTranslationTest::testBulkManagementParagraphsIgnoreFilterByLabel in Lingotek Translation 8

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

File

src/Tests/LingotekNodeParagraphsTranslationTest.php, line 228

Class

LingotekNodeParagraphsTranslationTest
Tests translating a node with multiple locales including paragraphs.

Namespace

Drupal\lingotek\Tests

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 = array();
  $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';
  $this
    ->drupalPostForm(NULL, $edit, t('Save and publish'));
  $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 PrivateTempStore $tempStore */
  $tempStore = \Drupal::service('user.private_tempstore')
    ->get('lingotek.management.filter.paragraph');
  $tempStore
    ->set('label', 'Llamas');
  $this
    ->goToContentBulkManagementForm('paragraph');
  $this
    ->assertText('Image + Text');
}