Commit b63924f8 authored by webchick's avatar webchick

Issue #1539614 by cosmicdreams, vasi1186: Modify language module to use...

Issue #1539614 by cosmicdreams, vasi1186: Modify language module to use Dependency Injection for language.
parent 9abacc9f
......@@ -321,7 +321,7 @@ function language_switcher_url($type, $path) {
*/
function language_switcher_session($type, $path) {
$param = variable_get('language_negotiation_session_param', 'language');
$language_query = isset($_SESSION[$param]) ? $_SESSION[$param] : $GLOBALS[$type]->langcode;
$language_query = isset($_SESSION[$param]) ? $_SESSION[$param] : drupal_container()->get($type)->langcode;
$languages = language_list();
$links = array();
......
......@@ -31,22 +31,6 @@ function setUp() {
drupal_container(new ContainerBuilder());
}
/**
* Test dependency injected Language against the GLOBAL language object.
*
* @todo Once the PHP global is gone, we won't need this test as the same
* test is done without the PHP global in the following test.
*/
function testDependencyInjectedLanguage() {
// Initialize the language system.
drupal_language_initialize();
$expected = $GLOBALS[LANGUAGE_TYPE_INTERFACE];
$result = drupal_container()->get(LANGUAGE_TYPE_INTERFACE);
foreach ($expected as $property => $value) {
$this->assertEqual($expected->$property, $result->$property, t('The dependency injected language object %prop property equals the $GLOBAL language object %prop property.', array('%prop' => $property)));
}
}
/**
* Test dependency injected languages against a new Language object.
......
......@@ -95,7 +95,7 @@ function language_test_language_negotiation_info_alter(array &$negotiation_info)
function language_test_store_language_negotiation() {
$last = array();
foreach (language_types_get_all() as $type) {
$last[$type] = $GLOBALS[$type]->langcode;
$last[$type] = drupal_container()->get($type)->langcode;
}
variable_set('language_test_language_negotiation_last', $last);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment