function AssertLegacyTrait::assertFieldById

Same name in other branches
  1. 9 core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php \Drupal\FunctionalTests\AssertLegacyTrait::assertFieldById()

Asserts that a field exists with the given ID and value.

Parameters

string $id: ID of field to assert.

string|\Drupal\Component\Render\MarkupInterface $value: (optional) Value for the field to assert. You may pass in NULL to skip checking the value, while still checking that the field exists. However, the default value ('') asserts that the field value is an empty string.

Throws

\Behat\Mink\Exception\ElementNotFoundException

Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->fieldExists() or $this->assertSession()->buttonExists() or $this->assertSession()->fieldValueEquals() instead.

28 calls to AssertLegacyTrait::assertFieldById()
BooleanFieldTest::testBooleanField in core/modules/field/tests/src/Functional/Boolean/BooleanFieldTest.php
Tests boolean field.
BrowserTestBaseTest::testFieldAssertsForButton in core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php
Tests legacy field asserts for button field type.
BrowserTestBaseTest::testFieldAssertsForCheckbox in core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php
Tests legacy field asserts for checkbox field type.
BrowserTestBaseTest::testFieldAssertsForTextfields in core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php
Tests legacy field asserts using textfields.
BulkFormTest::testBulkForm in core/modules/views/tests/src/Functional/BulkFormTest.php
Tests the bulk form.

... See full list

File

core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php, line 271

Class

AssertLegacyTrait
Provides convenience methods for assertions in browser tests.

Namespace

Drupal\FunctionalTests

Code

protected function assertFieldById($id, $value = '') {
    $this->assertFieldByXPath($this->constructFieldXpath('id', $id), $value);
}

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