You are here

protected function OptimizedbFunctionsTestCase::createCacheFormItem in OptimizeDB 7

Create new item in table "cache_form".

Parameters

int $cid: (optional) Cache ID.

bool|int $cache_time: (optional) Cache expire time.

Return value

DatabaseStatementInterface|int ID new cache item.

6 calls to OptimizedbFunctionsTestCase::createCacheFormItem()
OptimizedbFunctionsTestCase::testButtonsExecutingCommands in ./optimizedb.test
Testing module admin page buttons.
OptimizedbFunctionsTestCase::testClearTable in ./optimizedb.test
Test _optimizedb_clear_cache_form_table() function.
OptimizedbFunctionsTestCase::testCronClearTable in ./optimizedb.test
Test clear cache_form table in optimizedb_cron() function.
OptimizedbFunctionsTestCase::testCronClearTablePeriodTime in ./optimizedb.test
Testing, when set period of time clean-up table "cache_form" using Cron.
OptimizedbFunctionsTestCase::testCronClearTablePeriodTimeEmpty in ./optimizedb.test
Testing, when not set period of time clean-up table "cache_form" using Cron.

... See full list

File

./optimizedb.test, line 231
Tests for optimizedb.module.

Class

OptimizedbFunctionsTestCase
Test the module functions.

Code

protected function createCacheFormItem($cid = 1, $cache_time = FALSE) {
  if (!$cache_time) {
    $cache_time = REQUEST_TIME - 3600;
  }
  return db_insert('cache_form')
    ->fields(array(
    'cid' => $cid,
    'expire' => $cache_time,
    'created' => $cache_time,
  ))
    ->execute();
}