You are here

protected function WebformAssertLegacyTrait::assertFieldById in Webform 6.x

Same name and namespace in other branches
  1. 8.5 tests/src/Traits/WebformAssertLegacyTrait.php \Drupal\Tests\webform\Traits\WebformAssertLegacyTrait::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

9 calls to WebformAssertLegacyTrait::assertFieldById()
WebformElementAccessTest::testAccess in tests/src/Functional/Element/WebformElementAccessTest.php
Test element access.
WebformElementManagedFilePublicTest::testPublicUpload in tests/src/Functional/Element/WebformElementManagedFilePublicTest.php
Test public upload protection.
WebformElementStatesTest::testElement in tests/src/Functional/Element/WebformElementStatesTest.php
Tests element #states.
WebformExampleCompositeTest::testWebformExampleComposite in modules/webform_example_composite/tests/src/Functional/WebformExampleCompositeTest.php
Tests webform example element.
WebformOptionsLimitTest::testOptionsLimit in modules/webform_options_limit/tests/src/Functional/WebformOptionsLimitTest.php
Test options limit.

... See full list

File

tests/src/Traits/WebformAssertLegacyTrait.php, line 275

Class

WebformAssertLegacyTrait
Provides convenience methods for assertions in browser tests.

Namespace

Drupal\Tests\webform\Traits

Code

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