function CacheTest::testNoneCaching

Tests no caching.

See also

views_plugin_cache_time

File

drupal/core/modules/views/lib/Drupal/views/Tests/Plugin/CacheTest.php, line 90
Definition of Drupal\views\Tests\Plugin\CacheTest.

Class

CacheTest
Basic test for pluggable caching.

Namespace

Drupal\views\Tests\Plugin

Code

function testNoneCaching() {

  // Create a basic result which just 2 results.
  $view = views_get_view('test_cache');
  $view
    ->setDisplay();
  $view->display_handler
    ->overrideOption('cache', array(
    'type' => 'none',
    'options' => array(),
  ));
  $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 changes, because the view is not cached.
  $view = views_get_view('test_cache');
  $view
    ->setDisplay();
  $view->display_handler
    ->overrideOption('cache', array(
    'type' => 'none',
    'options' => array(),
  ));
  $this
    ->executeView($view);

  // Verify the result.
  $this
    ->assertEqual(6, count($view->result), t('The number of returned rows match.'));
}