You are here

public function ElementsTableSelectTest::testMultipleTrue in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/system/tests/src/Functional/Form/ElementsTableSelectTest.php \Drupal\Tests\system\Functional\Form\ElementsTableSelectTest::testMultipleTrue()
  2. 10 core/modules/system/tests/src/Functional/Form/ElementsTableSelectTest.php \Drupal\Tests\system\Functional\Form\ElementsTableSelectTest::testMultipleTrue()

Test the display of checkboxes when #multiple is TRUE.

File

core/modules/system/tests/src/Functional/Form/ElementsTableSelectTest.php, line 30

Class

ElementsTableSelectTest
Tests the tableselect form element for expected behavior.

Namespace

Drupal\Tests\system\Functional\Form

Code

public function testMultipleTrue() {
  $this
    ->drupalGet('form_test/tableselect/multiple-true');
  $this
    ->assertSession()
    ->responseNotContains('Empty text.', 'Empty text should not be displayed.');

  // Test for the presence of the Select all rows tableheader.
  $this
    ->assertNotEmpty($this
    ->xpath('//th[@class="select-all"]'), 'Presence of the "Select all" checkbox.');
  $rows = [
    'row1',
    'row2',
    'row3',
  ];
  foreach ($rows as $row) {
    $this
      ->assertNotEmpty($this
      ->xpath('//input[@type="checkbox"]', [
      $row,
    ]), "Checkbox for the value {$row}.");
  }
}