function ElementsTableSelectTest::testMultipleTrueSubmit in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/system/src/Tests/Form/ElementsTableSelectTest.php \Drupal\system\Tests\Form\ElementsTableSelectTest::testMultipleTrueSubmit()
Test the submission of single and multiple values when #multiple is TRUE.
File
- core/
modules/ system/ src/ Tests/ Form/ ElementsTableSelectTest.php, line 98 - Contains \Drupal\system\Tests\Form\ElementsTableSelectTest.
Class
- ElementsTableSelectTest
- Tests the tableselect form element for expected behavior.
Namespace
Drupal\system\Tests\FormCode
function testMultipleTrueSubmit() {
// Test a submission with one checkbox checked.
$edit = array();
$edit['tableselect[row1]'] = TRUE;
$this
->drupalPostForm('form_test/tableselect/multiple-true', $edit, 'Submit');
$this
->assertText(t('Submitted: row1 = row1'), 'Checked checkbox row1');
$this
->assertText(t('Submitted: row2 = 0'), 'Unchecked checkbox row2.');
$this
->assertText(t('Submitted: row3 = 0'), 'Unchecked checkbox row3.');
// Test a submission with multiple checkboxes checked.
$edit['tableselect[row1]'] = TRUE;
$edit['tableselect[row3]'] = TRUE;
$this
->drupalPostForm('form_test/tableselect/multiple-true', $edit, 'Submit');
$this
->assertText(t('Submitted: row1 = row1'), 'Checked checkbox row1.');
$this
->assertText(t('Submitted: row2 = 0'), 'Unchecked checkbox row2.');
$this
->assertText(t('Submitted: row3 = row3'), 'Checked checkbox row3.');
}