ViewRenderTest.php in Drupal 9
File
core/modules/views/tests/src/Kernel/ViewRenderTest.php
View source
<?php
namespace Drupal\Tests\views\Kernel;
use Drupal\views\Views;
class ViewRenderTest extends ViewsKernelTestBase {
public static $testViews = [
'test_view_render',
];
public function testRender() {
$state = $this->container
->get('state');
$state
->set('views_render.test', 0);
$view = Views::getView('test_view_render');
$output = $view
->preview();
$this->container
->get('renderer')
->renderRoot($output);
$this
->assertEquals(1, $state
->get('views_render.test'));
}
}