You are here

protected function WebformAssertLegacyTrait::constructFieldXpath in Webform 6.x

Same name and namespace in other branches
  1. 8.5 tests/src/Traits/WebformAssertLegacyTrait.php \Drupal\Tests\webform\Traits\WebformAssertLegacyTrait::constructFieldXpath()

Helper: Constructs an XPath for the given set of attributes and value.

Parameters

string $attribute: Field attributes.

string $value: Value of field.

Return value

string XPath for specified values.

6 calls to WebformAssertLegacyTrait::constructFieldXpath()
WebformAssertLegacyTrait::assertField in tests/src/Traits/WebformAssertLegacyTrait.php
Asserts that a field exists with the given name or ID.
WebformAssertLegacyTrait::assertFieldById in tests/src/Traits/WebformAssertLegacyTrait.php
Asserts that a field exists with the given ID and value.
WebformAssertLegacyTrait::assertFieldByName in tests/src/Traits/WebformAssertLegacyTrait.php
Asserts that a field exists with the given name and value.
WebformAssertLegacyTrait::assertNoField in tests/src/Traits/WebformAssertLegacyTrait.php
Asserts that a field does NOT exist with the given name or ID.
WebformAssertLegacyTrait::assertNoFieldById in tests/src/Traits/WebformAssertLegacyTrait.php
Asserts that a field does not exist with the given ID and value.

... See full list

File

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

Class

WebformAssertLegacyTrait
Provides convenience methods for assertions in browser tests.

Namespace

Drupal\Tests\webform\Traits

Code

protected function constructFieldXpath($attribute, $value) {
  $xpath = '//textarea[@' . $attribute . '=:value]|//input[@' . $attribute . '=:value]|//select[@' . $attribute . '=:value]';
  return $this
    ->buildXPathQuery($xpath, [
    ':value' => $value,
  ]);
}