You are here

protected function BackendGeneralTestCase::randomName in Supercache 2.0.x

Same name and namespace in other branches
  1. 8 src/Tests/Generic/Cache/BackendGeneralTestCase.php \Drupal\supercache\Tests\Generic\Cache\BackendGeneralTestCase::randomName()
3 calls to BackendGeneralTestCase::randomName()
BackendGetMultipleTests::testCacheMultiple in src/Tests/Generic/Cache/BackendGetMultipleTests.php
Test cache_get_multiple().
BackendSavingTests::testObject in src/Tests/Generic/Cache/BackendSavingTests.php
Test the saving and restoring of an object.
BackendSavingTests::testString in src/Tests/Generic/Cache/BackendSavingTests.php
Test the saving and restoring of a string.

File

src/Tests/Generic/Cache/BackendGeneralTestCase.php, line 42

Class

BackendGeneralTestCase
Testea funciones basicas.

Namespace

Drupal\supercache\Tests\Generic\Cache

Code

protected function randomName($length = 8) {
  $values = array_merge(range(65, 90), range(97, 122), range(48, 57));
  $max = count($values) - 1;
  $str = chr(mt_rand(97, 122));
  for ($i = 1; $i < $length; $i++) {
    $str .= chr($values[mt_rand(0, $max)]);
  }
  return $str;
}