You are here

public function HiddenLanguageBaseTestCase::enableUrlLanguageDetection in Hidden Language 7

Enable URL language detection.

1 call to HiddenLanguageBaseTestCase::enableUrlLanguageDetection()
HiddenLanguageAccessTest::setUp in ./hidden_language.test
Sets up a Drupal site for running functional and integration tests.

File

./hidden_language.test, line 114
Tests for Hidden Language module.

Class

HiddenLanguageBaseTestCase
Base class for Hidden Language module tests.

Code

public function enableUrlLanguageDetection($types = array(
  'language',
  'language_content',
)) {

  // Enable URL language detection and selection.
  // In some cases language_content is not available.
  $edit = array();
  if (is_array($types) && in_array('language', $types) || is_string($types) && $types == 'language') {
    $edit['language[enabled][locale-url]'] = TRUE;
  }
  if (is_array($types) && in_array('language_content', $types) || is_string($types) && $types == 'language_content') {
    $edit['language_content[enabled][locale-interface]'] = TRUE;
  }
  $this
    ->drupalPost('admin/config/regional/language/configure', $edit, t('Save settings'));
  $this
    ->assertRaw(t('Language negotiation configuration saved.'), t('URL language detection enabled.'));
  $this
    ->drupalGet('admin/config/regional/language/configure');

  // Reset caches.
  drupal_static_reset('locale_url_outbound_alter');
  drupal_static_reset('language_list');
}