function AssertLegacyTrait::buildXPathQuery

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

Builds an XPath query.

Builds an XPath query by replacing placeholders in the query by the value of the arguments.

XPath 1.0 (the version supported by libxml2, the underlying XML library used by PHP) doesn't support any form of quotation. This function simplifies the building of XPath expression.

Parameters

string $xpath: An XPath query, possibly with placeholders in the form ':name'.

array $args: An array of arguments with keys in the form ':name' matching the placeholders in the query. The values may be either strings or numeric values.

Return value

string An XPath query with arguments replaced.

Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->buildXPathQuery() instead.

9 calls to AssertLegacyTrait::buildXPathQuery()
AssertLegacyTrait::constructFieldXpath in core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php
Helper: Constructs an XPath for the given set of attributes and value.
BlockTest::moveBlockToRegion in core/modules/block/tests/src/Functional/BlockTest.php
Moves a block to a given region via the UI and confirms the result.
BlockTest::testBlock in core/modules/block/tests/src/Functional/BlockTest.php
Test configuring and moving a module-define block to specific regions.
EntityReferenceAdminTest::assertFieldSelectOptions in core/modules/field/tests/src/FunctionalJavascript/EntityReference/EntityReferenceAdminTest.php
Checks if a select element contains the specified options.
EntityReferenceAdminTest::assertFieldSelectOptions in core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php
Checks if a select element contains the specified options.

... See full list

File

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

Class

AssertLegacyTrait
Provides convenience methods for assertions in browser tests.

Namespace

Drupal\FunctionalTests

Code

protected function buildXPathQuery($xpath, array $args = []) {
    return $this->assertSession()
        ->buildXPathQuery($xpath, $args);
}

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