function VarsExtendedTestCase::testWritingVars in Variable API 6
Same name and namespace in other branches
- 6.2 tests/vars.test \VarsExtendedTestCase::testWritingVars()
- 7.2 tests/vars.test \VarsExtendedTestCase::testWritingVars()
- 7 tests/vars.test \VarsExtendedTestCase::testWritingVars()
File
- tests/
vars.test, line 164 - Test file for the Variable API module.
Class
Code
function testWritingVars() {
$written_variables = array();
Vars::staticReset();
$vars = new VarsExtendedTestVars();
$variables = $vars
->getDefaults();
foreach ($variables as $variable_name => $info) {
if (!empty($info['flags']) && $info['flags'] == Vars::VARS_DYNAMIC) {
$var_name = $variable_name . '_' . $this
->randomName(16);
}
elseif (empty($info['flags'])) {
$var_name = $variable_name;
}
$written_variables[$var_name] = $this
->randomName(16);
}
foreach ($written_variables as $var_name => $var_value) {
$vars[$var_name] = $var_value;
$this
->assertIdentical($vars[$var_name], $var_value, t('The value of the variable %var_name has been changed.', array(
'%var_name' => $var_name,
)));
$this
->assertTrue(vars_test_search_variable($var_name), t('The value of the variable %var_name has been retrieved in the database.', array(
'%var_name' => $var_name,
)));
}
}