function FieldUiTestTrait::assertFieldExistsOnOverview

Same name in other branches
  1. 10 core/modules/field_ui/tests/src/Traits/FieldUiTestTrait.php \Drupal\Tests\field_ui\Traits\FieldUiTestTrait::assertFieldExistsOnOverview()

Asserts that the field appears on the overview form.

Parameters

string $label: The field label.

Throws

\Behat\Mink\Exception\ElementNotFoundException

2 calls to FieldUiTestTrait::assertFieldExistsOnOverview()
EntityReferenceAdminTest::testFieldAdminHandler in core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php
Tests the Entity Reference Admin UI.
FieldUiTestTrait::fieldUIAddNewField in core/modules/field_ui/tests/src/Traits/FieldUiTestTrait.php
Creates a new field through the Field UI.

File

core/modules/field_ui/tests/src/Traits/FieldUiTestTrait.php, line 243

Class

FieldUiTestTrait
Provides common functionality for the Field UI test classes.

Namespace

Drupal\Tests\field_ui\Traits

Code

protected function assertFieldExistsOnOverview(string $label) {
    $xpath = $this->assertSession()
        ->buildXPathQuery("//table[@id=\"field-overview\"]//tr/td[1 and text() = :label]", [
        ':label' => $label,
    ]);
    $element = $this->getSession()
        ->getPage()
        ->find('xpath', $xpath);
    if ($element === NULL) {
        throw new ElementNotFoundException($this->getSession()
            ->getDriver(), 'form field', 'label', $label);
    }
}

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