Commit e16159ad authored by webchick's avatar webchick

Issue #1843948 by ACF: Added Change language test variables to the state system.

parent 199fcdfe
......@@ -56,7 +56,7 @@ function setUp() {
$this->drupalPost('admin/structure/types/manage/article', $edit, t('Save content type'));
// Enable content language negotiation UI.
variable_set('language_test_content_language_type', TRUE);
state()->set('language_test.content_language_type', TRUE);
// Set interface language detection to user and content language detection
// to URL. Disable inheritance from interface language to ensure content
......
......@@ -42,8 +42,8 @@ function setUp() {
*/
function testInfoAlterations() {
// Enable language type/negotiation info alterations.
variable_set('language_test_language_types', TRUE);
variable_set('language_test_language_negotiation_info', TRUE);
state()->set('language_test.language_types', TRUE);
state()->set('language_test.language_negotiation_info', TRUE);
$this->languageNegotiationUpdate();
// Check that fixed language types are properly configured without the need
......@@ -52,7 +52,7 @@ function testInfoAlterations() {
// Make the content language type configurable by updating the language
// negotiation settings with the proper flag enabled.
variable_set('language_test_content_language_type', TRUE);
state()->set('language_test.content_language_type', TRUE);
$this->languageNegotiationUpdate();
$type = LANGUAGE_TYPE_CONTENT;
$language_types = variable_get('language_types', language_types_get_default());
......@@ -73,7 +73,7 @@ function testInfoAlterations() {
// Remove the interface language negotiation method by updating the language
// negotiation settings with the proper flag enabled.
variable_set('language_test_language_negotiation_info_alter', TRUE);
state()->set('language_test.language_negotiation_info_alter', TRUE);
$this->languageNegotiationUpdate();
$negotiation = variable_get("language_negotiation_$type", array());
$this->assertFalse(isset($negotiation[$interface_method_id]), 'Interface language negotiation method removed from the stored settings.');
......@@ -93,7 +93,7 @@ function testInfoAlterations() {
// Check language negotiation results.
$this->drupalGet('');
$last = variable_get('language_test_language_negotiation_last', array());
$last = state()->get('language_test.language_negotiation_last');
foreach (language_types_get_all() as $type) {
$langcode = $last[$type];
$value = $type == LANGUAGE_TYPE_CONTENT || strpos($type, 'test') !== FALSE ? 'it' : 'en';
......
......@@ -367,7 +367,7 @@ protected function runTest($test) {
->save();
}
if (!empty($test['language_test_domain'])) {
variable_set('language_test_domain', $test['language_test_domain']);
state()->set('language_test.domain', $test['language_test_domain']);
}
$this->drupalGet($test['path'], array(), $test['http_header']);
$this->assertText($test['expect'], $test['message']);
......
......@@ -12,8 +12,8 @@
* the HTTP_HOST here
*/
function language_test_boot() {
if (variable_get('language_test_domain')) {
$_SERVER['HTTP_HOST'] = variable_get('language_test_domain');
if (state()->get('language_test.domain')) {
$_SERVER['HTTP_HOST'] = state()->get('language_test.domain');
}
}
......@@ -31,7 +31,7 @@ function language_test_init() {
* Implements hook_language_types_info().
*/
function language_test_language_types_info() {
if (variable_get('language_test_language_types', FALSE)) {
if (state()->get('language_test.language_types')) {
return array(
'test_language_type' => array(
'name' => t('Test'),
......@@ -48,7 +48,7 @@ function language_test_language_types_info() {
* Implements hook_language_types_info_alter().
*/
function language_test_language_types_info_alter(array &$language_types) {
if (variable_get('language_test_content_language_type', FALSE)) {
if (state()->get('language_test.content_language_type')) {
unset($language_types[LANGUAGE_TYPE_CONTENT]['fixed']);
}
}
......@@ -57,7 +57,7 @@ function language_test_language_types_info_alter(array &$language_types) {
* Implements hook_language_negotiation_info().
*/
function language_test_language_negotiation_info() {
if (variable_get('language_test_language_negotiation_info', FALSE)) {
if (state()->get('language_test.language_negotiation_info')) {
$info = array(
'callbacks' => array(
'negotiation' => 'language_test_language_negotiation_method',
......@@ -84,7 +84,7 @@ function language_test_language_negotiation_info() {
* Implements hook_language_negotiation_info_alter().
*/
function language_test_language_negotiation_info_alter(array &$negotiation_info) {
if (variable_get('language_test_language_negotiation_info_alter', FALSE)) {
if (state()->get('language_test.language_negotiation_info_alter')) {
unset($negotiation_info[LANGUAGE_NEGOTIATION_INTERFACE]);
}
}
......@@ -97,7 +97,7 @@ function language_test_store_language_negotiation() {
foreach (language_types_get_all() as $type) {
$last[$type] = language($type)->langcode;
}
variable_set('language_test_language_negotiation_last', $last);
state()->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