function LocaleUILanguageNegotiationTest::runTest

1 call to LocaleUILanguageNegotiationTest::runTest()
LocaleUILanguageNegotiationTest::testUILanguageNegotiation in modules/locale/locale.test
Tests for language switching by URL path.

File

modules/locale/locale.test, line 2505

Class

LocaleUILanguageNegotiationTest
Test UI language negotiation 1. URL (PATH) > DEFAULT UI Language base on URL prefix, browser language preference has no influence: admin/config UI in site default language zh-hans/admin/config UI in Chinese blah-blah/admin/config 404 2. URL (PATH)…

Code

private function runTest($test) {
    if (!empty($test['language_negotiation'])) {
        $negotiation = array_flip($test['language_negotiation']);
        language_negotiation_set(LANGUAGE_TYPE_INTERFACE, $negotiation);
    }
    if (!empty($test['locale_language_negotiation_url_part'])) {
        variable_set('locale_language_negotiation_url_part', $test['locale_language_negotiation_url_part']);
    }
    if (!empty($test['locale_test_domain'])) {
        variable_set('locale_test_domain', $test['locale_test_domain']);
    }
    $this->drupalGet($test['path'], array(), $test['http_header']);
    $this->assertText($test['expect'], $test['message']);
    $this->assertText(t('Language negotiation provider: @name', array(
        '@name' => $test['expected_provider'],
    )));
}

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