You are here

public function LocaleUpgradePathTestCase::testLocaleUpgradePathFallback in Drupal 7

Test an upgrade with path-based (with fallback) negotiation.

File

modules/simpletest/tests/upgrade/upgrade.locale.test, line 68

Class

LocaleUpgradePathTestCase
Upgrade test for locale.module.

Code

public function testLocaleUpgradePathFallback() {

  // LANGUAGE_NEGOTIATION_PATH.
  $this
    ->variable_set('language_negotiation', 2);

  // Set the language of the admin user to English.
  db_update('users')
    ->fields(array(
    'language' => 'en',
  ))
    ->condition('uid', 1)
    ->execute();
  $this
    ->assertTrue($this
    ->performUpgrade(), 'The upgrade was completed successfully.');

  // Both prefixes should be active.
  $this
    ->assertPageInLanguage('fr', 'fr');
  $this
    ->assertPageInLanguage('en', 'en');

  // The home page should be in the admin user language.
  $this
    ->assertPageInLanguage('', 'en');

  // The language switcher block should be displayed.
  $this
    ->assertRaw('block-locale-language', 'The language switcher block is displayed.');
}