You are here

function VarsBaseTestCase::testBaseFunctions in Variable API 7.2

Same name and namespace in other branches
  1. 6.2 tests/vars.test \VarsBaseTestCase::testBaseFunctions()
  2. 6 tests/vars.test \VarsBaseTestCase::testBaseFunctions()
  3. 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_static_reset();
  $var_name = 'vars_test_' . $this
    ->randomName(10);
  $test_value_1 =& vars_static_value($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_static_value($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_static_reset($var_name);
  $test_value_4 =& vars_static_value($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,
  )));
}