function VarsBaseTestCase::testBaseFunctions in Variable API 6
Same name and namespace in other branches
- 6.2 tests/vars.test \VarsBaseTestCase::testBaseFunctions()
- 7.2 tests/vars.test \VarsBaseTestCase::testBaseFunctions()
- 7 tests/vars.test \VarsBaseTestCase::testBaseFunctions()
File
- tests/
vars.test, line 21 - Test file for the Variable API module.
Class
- VarsBaseTestCase
- @file Test file for the Variable API module.
Code
function testBaseFunctions() {
Vars::staticReset();
$var_name = 'vars_test_' . $this
->randomName(10);
$test_value_1 =& Vars::staticValue($var_name, '12345');
$this
->assertTrue(isset($test_value_1) && $test_value_1 == '12345', t('The default value of the static variable %var_name has been retrieved.', array(
'%var_name' => $var_name,
)));
$test_value_1 = $this
->randomName(10);
$test_value_2 =& Vars::staticValue($var_name, '12345');
$this
->assertTrue(isset($test_value_2) && $test_value_2 == $test_value_1, t('The static variable %var_name has been changed.', array(
'%var_name' => $var_name,
)));
Vars::staticReset($var_name);
$test_value_4 =& Vars::staticValue($var_name, '12345');
$this
->assertTrue(isset($test_value_4) && $test_value_4 == '12345', t('The static variable %var_name has been reset to its default value.', array(
'%var_name' => $var_name,
)));
}