You are here

function geoipLanguageTestCase::setUp in GeoIP API 7

Same name and namespace in other branches
  1. 6 geoip_language/geoip_language.test \geoipLanguageTestCase::setUp()

Implementation of setUp().

Overrides DrupalWebTestCase::setUp

File

geoip_language/geoip_language.test, line 23
Test suite for geoip_language.module

Class

geoipLanguageTestCase
@file Test suite for geoip_language.module

Code

function setUp() {
  parent::setUp('locale', 'geoip', 'geoip_language');
  $this->admin_user = $this
    ->drupalCreateUser(array(
    'administer languages',
    'administer site configuration',
    'access administration pages',
  ));
  $this->visitor = $this
    ->drupalCreateUser(array(
    'access content',
  ));
  $this
    ->drupalLogin($this->admin_user);

  // Make sure default language has a prefix.
  $this
    ->drupalPost('admin/settings/language/edit/en', array(
    'prefix' => 'global',
  ), t('Save language'));

  // Add and map french/france
  $this
    ->addLanguage('fr');
  geoip_language_mapping_create('FR', 'fr');

  // Add and map german/germany
  $this
    ->addLanguage('de');
  geoip_language_mapping_create('DE', 'de');

  // reset language in the testing thread so url's get formatted properly.
  $GLOBALS['language'] = language_default();
  variable_set('geoip_debug', TRUE);
  variable_set('language_negotiation', GEOIP_LANGUAGE_NEGOTIATION_PATH);
}