You are here

public function RenderCacheBackendAdapterTest::test_setMultiple in Render cache 7.2

Tests that RenderCacheBackendAdapter::setMultiple() is working properly. @covers ::setMultiple() @covers ::set()

File

tests/src/Cache/RenderCacheBackendAdapterTest.php, line 237
Contains \Drupal\render_cache\Tests\Cache\RenderCacheBackendAdapterTest

Class

RenderCacheBackendAdapterTest
@coversDefaultClass \Drupal\render_cache\Cache\RenderCacheBackendAdapter @group cache

Namespace

Drupal\render_cache\Tests\Cache

Code

public function test_setMultiple() {

  // @todo consider using a data provider instead.
  $cache_info_map = array(
    'no' => $this
      ->getCacheInfo('render:foo:no', RenderCache::RENDER_CACHE_STRATEGY_NO_RENDER),
    'late' => $this
      ->getCacheInfo('render:foo:late', RenderCache::RENDER_CACHE_STRATEGY_LATE_RENDER),
  );
  $build = array();
  foreach ($cache_info_map as $id => $cache_info) {
    $build[$id] = $this->cacheHitData->data;
  }
  $this->cache
    ->setMultiple($build, $cache_info_map);
  $this
    ->assertEquals($this->cacheHitNoRender, $build['no'], 'Data is the same for no render strategy');
  $this
    ->assertEquals($this->cacheHitLateRender, $build['late'], 'Data is the same for late render strategy');
}