function TranslationTest::findContentByXPath

Searches for elements matching the given xpath and value.

Parameters

$xpath: The XPath used to find the element.

array $arguments: 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.

$value: The text content of the matched element to assert.

Return value

TRUE if found, otherwise FALSE.

2 calls to TranslationTest::findContentByXPath()
TranslationTest::assertContentByXPath in drupal/core/modules/translation/lib/Drupal/translation/Tests/TranslationTest.php
Asserts an element identified by the given XPath has the given content.
TranslationTest::assertLanguageSwitchLinks in drupal/core/modules/translation/lib/Drupal/translation/Tests/TranslationTest.php
Tests whether the specified language switch links are found.

File

drupal/core/modules/translation/lib/Drupal/translation/Tests/TranslationTest.php, line 496
Definition of Drupal\translation\Tests\TranslationTest.

Class

TranslationTest
Functional tests for the Translation module.

Namespace

Drupal\translation\Tests

Code

function findContentByXPath($xpath, array $arguments = array(), $value = NULL) {
  $elements = $this
    ->xpath($xpath, $arguments);
  $found = TRUE;
  if ($value && $elements) {
    $found = FALSE;
    foreach ($elements as $element) {
      if ((string) $element == $value) {
        $found = TRUE;
        break;
      }
    }
  }
  return $elements && $found;
}