function i18nAccessTestCase::testTranslatorUser in Translation Access 6
Same name and namespace in other branches
- 7 i18n_access.test \i18nAccessTestCase::testTranslatorUser()
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 169 - Test suite for i18n_access.module
Class
- i18nAccessTestCase
- @file Test suite for i18n_access.module
Code
function testTranslatorUser() {
$this
->drupalLogin($this->translator);
$this
->drupalGet('node/add/story');
$this
->assertField('language', t('Found language selector.'));
$perms = i18n_access_load_permissions($this->translator->uid);
$languages = language_list();
$languages[I18N_ACCESS_LANGUAGE_NEUTRAL] = (object) array(
'language' => '',
'name' => 'Language Neutral',
);
foreach ($languages as $key => $language) {
// TODO: Add in check for language neutral
if (isset($perms[$key]) && $perms[$key]) {
$this
->assertLanguageOption($language->language, t('Option found for %language in language selector.', array(
'%language' => $language->name,
)));
}
else {
$this
->assertNoLanguageOption($language->language, t('Option not found for %language in language selector.', array(
'%language' => $language->name,
)));
}
}
}