1 translation.test | TranslationTestCase::findContentByXPath($xpath, array $arguments = array(), $value = NULL) |
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.:
File
- core/
modules/ translation/ tests/ translation.test, line 502 - Tests for the Translation module.
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;
}