You are here

function LanguageHierarchyBaseTestCase::enableUrlLanguageDetection in Language Hierarchy 7

Enable URL language detection.

3 calls to LanguageHierarchyBaseTestCase::enableUrlLanguageDetection()
EntityTranslationHierarchyBaseTestCase::setUp in modules/entity_translation_hierarchy/tests/entity_translation_hierarchy.test
Sets up a Drupal site for running functional and integration tests.
LanguageHierarchyI18nVariableTranslationWebTestCase::testVariableUITranslation in modules/i18n_variable_hierarchy/i18n_variable_hierarchy.test
Test translating a variable, with hierarchy.
MenuTranslationHierarchyWebTestCase::setUp in modules/i18n_menu_hierarchy/tests/i18n_menu_hierarchy.test
Sets up a Drupal site for running functional and integration tests.

File

tests/language_hierarchy.test, line 166
Tests for Language Hierarchy module.

Class

LanguageHierarchyBaseTestCase
Base class for Language Hierarchy module tests.

Code

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');
}