function AssertLegacyTrait::assertFieldByName

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

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

Parameters

string $name: Name of field to assert.

string $value: (optional) Value of the field to assert. You may pass in NULL (default) to skip checking the actual value, while still checking that the field exists.

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.

106 calls to AssertLegacyTrait::assertFieldByName()
AggregatorAdminTest::testSettingsPage in core/modules/aggregator/tests/src/Functional/AggregatorAdminTest.php
Tests the settings form to ensure the correct default values are used.
ArbitraryRebuildTest::testUserRegistrationMultipleField in core/modules/system/tests/src/Functional/Form/ArbitraryRebuildTest.php
Tests a rebuild caused by a multiple value field.
ArbitraryRebuildTest::testUserRegistrationRebuild in core/modules/system/tests/src/Functional/Form/ArbitraryRebuildTest.php
Tests a basic rebuild with the user registration form.
AreaEntityUITest::testUI in core/modules/views_ui/tests/src/Functional/AreaEntityUITest.php
BlockContentListViewsTest::testListing in core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php
Tests the custom block listing page.

... See full list

File

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

Class

AssertLegacyTrait
Provides convenience methods for assertions in browser tests.

Namespace

Drupal\FunctionalTests

Code

protected function assertFieldByName($name, $value = NULL) {
    $this->assertFieldByXPath($this->constructFieldXpath('name', $name), $value);
}

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