You are here

public function FormTest::testEmptySelect in Drupal 8

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

Tests a select element when #options is not set.

File

core/modules/system/tests/src/Functional/Form/FormTest.php, line 475

Class

FormTest
Tests various form element validation mechanisms.

Namespace

Drupal\Tests\system\Functional\Form

Code

public function testEmptySelect() {
  $this
    ->drupalGet('form-test/empty-select');
  $this
    ->assertFieldByXPath("//select[1]", NULL, 'Select element found.');
  $this
    ->assertNoFieldByXPath("//select[1]/option", NULL, 'No option element found.');
}