Tests time based caching.
views_plugin_cache_time
function testTimeCaching() {
// Create a basic result which just 2 results.
$view = views_get_view('test_cache');
$view
->setDisplay();
$view->display_handler
->overrideOption('cache', array(
'type' => 'time',
'options' => array(
'results_lifespan' => '3600',
'output_lifespan' => '3600',
),
));
$this
->executeView($view);
// Verify the result.
$this
->assertEqual(5, count($view->result), t('The number of returned rows match.'));
// Add another man to the beatles.
$record = array(
'name' => 'Rod Davis',
'age' => 29,
'job' => 'Banjo',
);
drupal_write_record('views_test_data', $record);
// The Result should be the same as before, because of the caching.
$view = views_get_view('test_cache');
$view
->setDisplay();
$view->display_handler
->overrideOption('cache', array(
'type' => 'time',
'options' => array(
'results_lifespan' => '3600',
'output_lifespan' => '3600',
),
));
$this
->executeView($view);
// Verify the result.
$this
->assertEqual(5, count($view->result), t('The number of returned rows match.'));
}