You are here

public function MemCacheSavingCase::checkVariable in Memcache API and Integration 7

Same name in this branch
  1. 7 tests/memcache.test \MemCacheSavingCase::checkVariable()
  2. 7 tests/memcache6.test \MemCacheSavingCase::checkVariable()
Same name and namespace in other branches
  1. 6 tests/memcache.test \MemCacheSavingCase::checkVariable()

Check or a variable is stored and restored properly.

12 calls to MemCacheSavingCase::checkVariable()
MemCacheSavingCase::testArray in tests/memcache.test
Test the saving and restoring of an array.
MemCacheSavingCase::testArray in tests/memcache6.test
Test the saving and restoring of an array.
MemCacheSavingCase::testDouble in tests/memcache.test
Test the saving and restoring of a double.
MemCacheSavingCase::testDouble in tests/memcache6.test
Test the saving and restoring of a double.
MemCacheSavingCase::testInteger in tests/memcache.test
Test the saving and restoring of an integer.

... See full list

File

tests/memcache.test, line 359
Test cases for the memcache cache backend.

Class

MemCacheSavingCase

Code

public function checkVariable($var, $key = 'test_var') {
  cache_set($key, $var, $this->default_bin);
  $cache = cache_get($key, $this->default_bin);
  $this
    ->assertTrue(isset($cache->data) && $cache->data === $var, t('@type is saved and restored properly!key.', array(
    '@type' => ucfirst(gettype($var)),
    '!key' => $key != 'test_var' ? t(' with key @key', array(
      '@key' => $key,
    )) : '',
  )));
}