You are here

public function RenderStackTest::test_render_common in Render cache 7.2

@covers ::render()

File

tests/src/Cache/RenderStackTest.php, line 192
Contains \Drupal\render_cache\Tests\Cache\RenderStackTest

Class

RenderStackTest
@coversDefaultClass \Drupal\render_cache\Cache\RenderStack @group cache

Namespace

Drupal\render_cache\Tests\Cache

Code

public function test_render_common() {
  $storage = array(
    '#cache' => array(
      'tags' => array(
        'node:1',
        'node:2',
      ),
      'max-age' => array(
        600,
      ),
      'downstream-ttl' => array(
        300,
      ),
    ),
    '#attached' => array(
      'library' => array(
        array(
          'foo',
          'bar',
        ),
      ),
      'js' => array(
        'foo.js',
      ),
      'css' => array(
        'foo.css',
      ),
    ),
    '#post_render_cache' => array(
      'test_post_render_cache' => array(),
    ),
  );
  $render = array(
    '#markup' => 'foo',
    '#attached' => array(
      'library' => array(
        array(
          'inner',
          'baz',
        ),
      ),
      'js' => array(
        'baz.js',
      ),
    ),
    '#cache' => array(
      'tags' => array(
        'node:1',
      ),
    ),
    'bar' => array(
      '#markup' => 'bar',
    ),
  );
  $original_render_result = array(
    '#markup' => 'foo',
    '#printed' => TRUE,
    'bar' => array(
      '#markup' => 'bar',
      '#printed' => TRUE,
    ),
    '#attached' => array(
      'library' => array(
        array(
          'inner',
          'baz',
        ),
      ),
      'js' => array(
        'baz.js',
      ),
    ),
  );
  $render_result = array(
    '#markup' => 'foobar',
    '#attached' => array(
      'library' => array(
        array(
          'foo',
          'bar',
        ),
        array(
          'inner',
          'baz',
        ),
      ),
      'js' => array(
        'foo.js',
        'baz.js',
      ),
      'css' => array(
        'foo.css',
      ),
    ),
  ) + $storage;
  return array(
    $storage,
    $render,
    $original_render_result,
    $render_result,
  );
}