You are here

protected function AssertContentTrait::constructFieldXpath in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/simpletest/src/AssertContentTrait.php \Drupal\simpletest\AssertContentTrait::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.

12 calls to AssertContentTrait::constructFieldXpath()
AssertContentTrait::assertField in core/modules/simpletest/src/AssertContentTrait.php
Asserts that a field exists with the given name or ID.
AssertContentTrait::assertFieldById in core/modules/simpletest/src/AssertContentTrait.php
Asserts that a field exists with the given ID and value.
AssertContentTrait::assertFieldByName in core/modules/simpletest/src/AssertContentTrait.php
Asserts that a field exists with the given name and value.
AssertContentTrait::assertNoField in core/modules/simpletest/src/AssertContentTrait.php
Asserts that a field does not exist with the given name or ID.
AssertContentTrait::assertNoFieldById in core/modules/simpletest/src/AssertContentTrait.php
Asserts that a field does not exist with the given ID and value.

... See full list

File

core/modules/simpletest/src/AssertContentTrait.php, line 1478
Contains \Drupal\simpletest\AssertContentTrait.

Class

AssertContentTrait
Provides test methods to assert content.

Namespace

Drupal\simpletest

Code

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