You are here

ViewRenderTest.php in Zircon Profile 8.0

Same filename and directory in other branches
  1. 8 core/modules/views/src/Tests/ViewRenderTest.php

Namespace

Drupal\views\Tests

File

core/modules/views/src/Tests/ViewRenderTest.php
View source
<?php

/**
 * @file
 * Contains \Drupal\views\Tests\ViewRenderTest.
 */
namespace Drupal\views\Tests;

use Drupal\views\Views;

/**
 * Tests general rendering of a view.
 *
 * @group views
 */
class ViewRenderTest extends ViewTestBase {

  /**
   * Views used by this test.
   *
   * @var array
   */
  public static $testViews = array(
    'test_view_render',
  );
  protected function setUp() {
    parent::setUp();
    $this
      ->enableViewsTestModule();
  }

  /**
   * Tests render functionality.
   */
  public function testRender() {
    \Drupal::state()
      ->set('views_render.test', 0);

    // Make sure that the rendering just calls the preprocess function once.
    $view = Views::getView('test_view_render');
    $output = $view
      ->preview();
    $this->container
      ->get('renderer')
      ->renderRoot($output);
    $this
      ->assertEqual(\Drupal::state()
      ->get('views_render.test'), 1);
  }

}

Classes

Namesort descending Description
ViewRenderTest Tests general rendering of a view.