Skip to content
Snippets Groups Projects
Commit e4ff0cd6 authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Patch #304139 by Rob Loach, beeradb, Damien, et al: tests for the variable_*() functions.

parent 763b11c8
No related branches found
No related tags found
No related merge requests found
......@@ -108,3 +108,45 @@ class BootstrapPageCacheTestCase extends DrupalWebTestCase {
}
}
class BootstrapVariableTestCase extends DrupalWebTestCase {
/**
* Implementation of setUp().
*/
function setUp() {
parent::setUp('system_test');
}
/**
* Implementation of getInfo().
*/
function getInfo() {
return array(
'name' => t('Variable test'),
'description' => t('Make sure the variable system functions correctly.'),
'group' => t('Bootstrap')
);
}
/**
* testVariable
*/
function testVariable() {
// Setting and retrieving values.
$variable = $this->randomName();
variable_set('simpletest_bootstrap_variable_test', $variable);
$this->assertIdentical($variable, variable_get('simpletest_bootstrap_variable_test', NULL), t('Setting and retrieving values'));
// Make sure the variable persists across multiple requests.
$this->drupalGet('system-test/variable-get');
$this->assertText($variable, t('Variable persists across multiple requests'));
// Deleting variables.
$default_value = $this->randomName();
variable_del('simpletest_bootstrap_variable_test');
$variable = variable_get('simpletest_bootstrap_variable_test', $default_value);
$this->assertIdentical($variable, $default_value, t('Deleting variables'));
}
}
......@@ -40,6 +40,14 @@ function system_test_menu() {
'type' => MENU_CALLBACK,
);
$items['system-test/variable-get'] = array(
'title' => 'Variable Get',
'page callback' => 'variable_get',
'page arguments' => array('simpletest_bootstrap_variable_test', NULL),
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
return $items;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment