function i18nAccessTestCase::assertLanguageOption in Translation Access 7
Same name and namespace in other branches
- 6 i18n_access.test \i18nAccessTestCase::assertLanguageOption()
Assert that a language option exists in the language select field on the current page.
Parameters
$langcode: Value of the language option to assert.
$message: Message to display.
$group: The group this message belongs to.
Return value
TRUE on pass, FALSE on fail.
2 calls to i18nAccessTestCase::assertLanguageOption()
- i18nAccessTestCase::testAdminUser in ./
i18n_access.test - Test admin user. User with 'administer nodes' permission should be able to create and edit nodes regardless of the language
- i18nAccessTestCase::testTranslatorUser in ./
i18n_access.test - Test translator user. User with 'create story content' and 'edit own story content' permissions should be able to create and edit story nodes only in the languages that they have permissions for.
File
- ./
i18n_access.test, line 109 - Test suite for i18n_access.module
Class
- i18nAccessTestCase
- @file Test suite for i18n_access.module
Code
function assertLanguageOption($langcode, $message, $group = 'Other') {
$xpath = '//select[@name="language"]/option';
$fields = $this
->xpath($xpath);
// If value specified then check array for match.
$found = TRUE;
if (isset($langcode)) {
$found = FALSE;
if ($fields) {
foreach ($fields as $field) {
if ($field['value'] == $langcode) {
$found = TRUE;
}
}
}
}
return $this
->assertTrue($fields && $found, $message, $group);
}