function AssertLegacyTrait::buildXPathQuery

Same name in other branches
  1. 8.9.x 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.

See also

https://www.drupal.org/node/3129738

1 call to AssertLegacyTrait::buildXPathQuery()
BrowserTestBaseTest::testBuildXPathQuery in core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php
Tests legacy buildXPathQuery().

File

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

Class

AssertLegacyTrait
Provides convenience methods for assertions in browser tests.

Namespace

Drupal\FunctionalTests

Code

protected function buildXPathQuery($xpath, array $args = []) {
    @trigger_error('AssertLegacyTrait::buildXPathQuery() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->buildXPathQuery() instead. See https://www.drupal.org/node/3129738', E_USER_DEPRECATED);
    return $this->assertSession()
        ->buildXPathQuery($xpath, $args);
}

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