function TranslationTestCase::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 TranslationTestCase::findContentByXPath()
- TranslationTestCase::assertContentByXPath in modules/
translation/ translation.test - Asserts an element identified by the given XPath has the given content.
- TranslationTestCase::assertLanguageSwitchLinks in modules/
translation/ translation.test - Tests whether the specified language switch links are found.
File
-
modules/
translation/ translation.test, line 478
Class
- TranslationTestCase
- Functional tests for the Translation module.
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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.