You are here

class ViewRenderTest in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views/tests/src/Kernel/ViewRenderTest.php \Drupal\Tests\views\Kernel\ViewRenderTest
  2. 9 core/modules/views/tests/src/Kernel/ViewRenderTest.php \Drupal\Tests\views\Kernel\ViewRenderTest

Tests general rendering of a view.

@group views

Hierarchy

Expanded class hierarchy of ViewRenderTest

File

core/modules/views/tests/src/Kernel/ViewRenderTest.php, line 12

Namespace

Drupal\Tests\views\Kernel
View source
class ViewRenderTest extends ViewsKernelTestBase {

  /**
   * {@inheritdoc}
   */
  public static $testViews = [
    'test_view_render',
  ];

  /**
   * Tests render functionality.
   */
  public function testRender() {
    $state = $this->container
      ->get('state');
    $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
      ->assertEquals(1, $state
      ->get('views_render.test'));
  }

}

Members