You are here

public function LingotekConfigBulkFormTest::testFieldConfigFilter in Lingotek Translation 8

Tests that the field config filtering works correctly.

File

src/Tests/Form/LingotekConfigBulkFormTest.php, line 78

Class

LingotekConfigBulkFormTest
Tests the config bulk management form.

Namespace

Drupal\lingotek\Tests\Form

Code

public function testFieldConfigFilter() {
  $this
    ->goToConfigBulkManagementForm();

  // Let's filter by node fields.
  $edit = [
    'filters[wrapper][bundle]' => 'node_fields',
  ];
  $this
    ->drupalPostForm(NULL, $edit, t('Filter'));

  // Assert that there is a "Bundle" header on the second position.
  // First position is the checkbox, that's why we care about the second.
  $second_header = (string) $this
    ->xpath('//*[@id="edit-table"]/thead/tr/th[2]')[0];
  $this
    ->assertEqual($second_header, 'Bundle', 'There is a Bundle header.');
  $third_header = (string) $this
    ->xpath('//*[@id="edit-table"]/thead/tr/th[3]')[0];
  $this
    ->assertEqual($third_header, 'Entity', 'There is a Entity header.');

  // Assert that there is a bundle printed with the Body field, and by that
  // Body must be appear twice.
  $this
    ->assertUniqueText('Article');
  $this
    ->assertUniqueText('Page');
  $this
    ->assertText('Body');
  $this
    ->assertNoUniqueText('Body');
}