protected function AssertLegacyTrait::assertFieldByXPath in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php \Drupal\FunctionalTests\AssertLegacyTrait::assertFieldByXPath()
Asserts that a field exists in the current page by the given XPath.
Parameters
string $xpath: XPath used to find the field.
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.
string $message: (optional) A message to display with the assertion. Do not translate messages with t().
Deprecated
in drupal:8.3.0 and is removed from drupal:10.0.0. Use $this->xpath() instead and check the values directly in the test.
See also
https://www.drupal.org/node/3129738
4 calls to AssertLegacyTrait::assertFieldByXPath()
- AssertLegacyTrait::assertField in core/
tests/ Drupal/ FunctionalTests/ AssertLegacyTrait.php - Asserts that a field exists with the given name or ID.
- AssertLegacyTrait::assertFieldById in core/
tests/ Drupal/ FunctionalTests/ AssertLegacyTrait.php - Asserts that a field exists with the given ID and value.
- AssertLegacyTrait::assertFieldByName in core/
tests/ Drupal/ FunctionalTests/ AssertLegacyTrait.php - Asserts that a field exists with the given name and value.
- BrowserTestBaseTest::testAssertFieldById in core/
tests/ Drupal/ FunctionalTests/ BrowserTestBaseTest.php - Tests legacy field asserts by id and by Xpath.
File
- core/
tests/ Drupal/ FunctionalTests/ AssertLegacyTrait.php, line 674
Class
- AssertLegacyTrait
- Provides convenience methods for assertions in browser tests.
Namespace
Drupal\FunctionalTestsCode
protected function assertFieldByXPath($xpath, $value = NULL, $message = '') {
@trigger_error('AssertLegacyTrait::assertFieldByXPath() is deprecated in drupal:8.3.0 and is removed from drupal:10.0.0. Use $this->xpath() instead and check the values directly in the test. See https://www.drupal.org/node/3129738', E_USER_DEPRECATED);
$fields = $this
->xpath($xpath);
$this
->assertFieldsByValue($fields, $value, $message);
}