function WebformLocalizationWebTestCase::setUp in Webform Localization 7.4
Same name and namespace in other branches
- 7 tests/webform_localization.test \WebformLocalizationWebTestCase::setUp()
Implements setUp().
Overrides DrupalWebTestCase::setUp
3 calls to WebformLocalizationWebTestCase::setUp()
- WebformLocalizationApiTestCase::setUp in tests/
webform_localization.test - Set up test.
- WebformLocalizationStringTranslationTestCase::setUp in tests/
webform_localization.test - Set up test.
- WebformLocalizationSubmissionTestCase::setUp in tests/
webform_localization.submission.test - Implements setUp().
3 methods override WebformLocalizationWebTestCase::setUp()
- WebformLocalizationApiTestCase::setUp in tests/
webform_localization.test - Set up test.
- WebformLocalizationStringTranslationTestCase::setUp in tests/
webform_localization.test - Set up test.
- WebformLocalizationSubmissionTestCase::setUp in tests/
webform_localization.submission.test - Implements setUp().
File
- tests/
webform_localization.test, line 21 - Webform localization module tests.
Class
- WebformLocalizationWebTestCase
- @file Webform localization module tests.
Code
function setUp($added_modules = array()) {
$modules = array(
'webform_localization',
'webform',
'views',
'ctools',
'i18n_translation',
'i18n_string',
'i18n',
'variable',
'translation',
'locale',
'block',
);
$added_modules = array_merge($modules, $added_modules);
parent::setUp($added_modules);
// We load webform test class to reuse webform and components creation functions.
module_load_include('test', 'webform', 'tests/webform');
$this->wtc = new WebformTestCase();
/* Reset the permissions cache prior to calling drupalCreateUser
* see notes here: https://api.drupal.org/comment/28739#comment-28739
*/
$this
->checkPermissions(array(), TRUE);
// Setup users.
$this->adminuser = $this
->drupalCreateUser(array(
'bypass node access',
'administer nodes',
'administer languages',
'administer content types',
'administer blocks',
'access administration pages',
'translate content',
'create webform content',
'edit any webform content',
'access all webform results',
'edit all webform submissions',
'delete all webform submissions',
'edit webform components',
'translate interface',
'translate user-defined strings',
));
/* Reset the permissions cache prior to calling drupalCreateUser
* see notes here: https://api.drupal.org/comment/28739#comment-28739
*/
$this
->checkPermissions(array(
'access content',
), TRUE);
$this->translator = $this
->drupalCreateUser(array(
'translate content',
'create webform content',
'edit any webform content',
'access all webform results',
'edit webform components',
'translate interface',
'translate user-defined strings',
));
/* Reset the permissions cache prior to calling drupalCreateUser
* see notes here: https://api.drupal.org/comment/28739#comment-28739
*/
$this
->checkPermissions(array(
'access content',
), TRUE);
$this->normaluser = $this
->drupalCreateUser(array(
'access content',
'edit own webform submissions',
));
// Fix for reuse of webform test class.
$this->wtc->webform_users['admin'] = $this->adminuser;
$this->wtc->webform_users['admin']->gender = array(
LANGUAGE_NONE => array(
array(
'value' => 'Female',
),
),
);
$this
->drupalLogin($this->adminuser);
// Add languages.
$this
->addLanguage('en');
$this
->addLanguage('es');
$this
->addLanguage('de');
// Enable URL language detection and selection.
$edit = array(
'language[enabled][locale-url]' => TRUE,
);
$this
->drupalPost('admin/config/regional/language/configure', $edit, t('Save settings'));
$this
->assertRaw(t('Language negotiation configuration saved.'), 'URL language detection enabled.');
drupal_static_reset('locale_url_outbound_alter');
}