function ElementsTableSelectTest::testMultipleTrue

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/Form/ElementsTableSelectTest.php \Drupal\Tests\system\Functional\Form\ElementsTableSelectTest::testMultipleTrue()
  2. 8.9.x core/modules/system/tests/src/Functional/Form/ElementsTableSelectTest.php \Drupal\Tests\system\Functional\Form\ElementsTableSelectTest::testMultipleTrue()
  3. 11.x core/modules/system/tests/src/Functional/Form/ElementsTableSelectTest.php \Drupal\Tests\system\Functional\Form\ElementsTableSelectTest::testMultipleTrue()

Tests the display of checkboxes when #multiple is TRUE.

File

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

Class

ElementsTableSelectTest
Tests the tableselect form element for expected behavior.

Namespace

Drupal\Tests\system\Functional\Form

Code

public function testMultipleTrue() : void {
    $this->drupalGet('form_test/tableselect/multiple-true');
    $this->assertSession()
        ->responseNotContains('Empty text.');
    // Test for the presence of the Select all rows tableheader.
    $this->assertSession()
        ->elementExists('xpath', '//th[@class="select-all"]');
    $rows = [
        'row1',
        'row2',
        'row3',
    ];
    foreach ($rows as $row) {
        $this->assertSession()
            ->elementExists('xpath', '//input[@type="checkbox"]');
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.