You are here

public function LingotekConfigBulkFormTest::testFieldConfigFilter in Lingotek Translation 3.6.x

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

Tests that the field config filtering works correctly.

File

tests/src/Functional/Form/LingotekConfigBulkFormTest.php, line 72

Class

LingotekConfigBulkFormTest
Tests the config bulk management form.

Namespace

Drupal\Tests\lingotek\Functional\Form

Code

public function testFieldConfigFilter() {
  $assert_session = $this
    ->assertSession();
  $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 = $this
    ->xpath('//*[@id="edit-table"]/thead/tr/th[2]/a')[0];
  $this
    ->assertEqual($second_header
    ->getHtml(), 'Bundle', 'There is a Bundle header.');
  $third_header = $this
    ->xpath('//*[@id="edit-table"]/thead/tr/th[3]/a')[0];
  $this
    ->assertEqual($third_header
    ->getHtml(), '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.
  $td = $this
    ->xpath('//td[text()="Article"]');
  $this
    ->assertCount(1, $td);
  $td = $this
    ->xpath('//td[text()="Page"]');
  $this
    ->assertCount(1, $td);

  // There are two bodies, one for page and one for article.
  $td = $this
    ->xpath('//td[text()="Body"]');
  $this
    ->assertCount(2, $td);
}