7.x cache.test CacheSavingCase::checkVariable($var)

Check or a variable is stored and restored properly.

4 calls to CacheSavingCase::checkVariable()
CacheSavingCase::testArray in modules/simpletest/tests/cache.test
Test the saving and restoring of an array.
CacheSavingCase::testDouble in modules/simpletest/tests/cache.test
Test the saving and restoring of a double.
CacheSavingCase::testInteger in modules/simpletest/tests/cache.test
Test the saving and restoring of an integer.
CacheSavingCase::testString in modules/simpletest/tests/cache.test
Test the saving and restoring of a string.

File

modules/simpletest/tests/cache.test, line 157

Class

CacheSavingCase

Code

function checkVariable($var) {
  cache_set('test_var', $var, 'cache');
  $cache = cache_get('test_var', 'cache');
  $this
    ->assertTrue(isset($cache->data) && $cache->data === $var, format_string('@type is saved and restored properly.', array(
    '@type' => ucfirst(gettype($var)),
  )));
}