function LocaleUrlRewritingTest::setUp

Overrides DrupalWebTestCase::setUp

File

modules/locale/locale.test, line 2630

Class

LocaleUrlRewritingTest
Test that URL rewriting works as expected.

Code

function setUp() {
    parent::setUp('locale');
    // Create and login user.
    $this->web_user = $this->drupalCreateUser(array(
        'administer languages',
        'access administration pages',
    ));
    $this->drupalLogin($this->web_user);
    // Install French language.
    $edit = array();
    $edit['langcode'] = 'fr';
    $this->drupalPost('admin/config/regional/language/add', $edit, t('Add language'));
    // Install Italian language.
    $edit = array();
    $edit['langcode'] = 'it';
    $this->drupalPost('admin/config/regional/language/add', $edit, t('Add language'));
    // Disable Italian language.
    $edit = array(
        'enabled[it]' => FALSE,
    );
    $this->drupalPost('admin/config/regional/language', $edit, t('Save configuration'));
    // Enable URL language detection and selection.
    $edit = array(
        'language[enabled][locale-url]' => 1,
    );
    $this->drupalPost('admin/config/regional/language/configure', $edit, t('Save settings'));
    // Reset static caching.
    drupal_static_reset('language_list');
    drupal_static_reset('locale_url_outbound_alter');
    drupal_static_reset('locale_language_url_rewrite_url');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.