function ManageFieldsTest::testLabelFieldFormValidation

Same name in other branches
  1. 10 core/modules/field_ui/tests/src/FunctionalJavascript/ManageFieldsTest.php \Drupal\Tests\field_ui\FunctionalJavascript\ManageFieldsTest::testLabelFieldFormValidation()

Tests the form validation for label field.

File

core/modules/field_ui/tests/src/FunctionalJavascript/ManageFieldsTest.php, line 361

Class

ManageFieldsTest
Tests the Field UI "Manage Fields" screens.

Namespace

Drupal\Tests\field_ui\FunctionalJavascript

Code

public function testLabelFieldFormValidation() : void {
    $this->drupalGet('/admin/structure/types/manage/article/fields/add-field');
    $page = $this->getSession()
        ->getPage();
    $page->findButton('Continue')
        ->click();
    $this->assertSession()
        ->pageTextContains('You need to select a field type.');
    $this->assertNotEmpty($boolean_field = $page->find('xpath', '//*[text() = "Boolean (overridden by alter)"]')
        ->getParent());
    $boolean_field->click();
    $page->findButton('Continue')
        ->click();
    $page->findButton('Continue')
        ->click();
    $this->assertSession()
        ->pageTextContains('Add new field: you need to provide a label.');
}

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