class ViewRenderTest
Same name and namespace in other branches
- 11.x core/modules/views/tests/src/Kernel/ViewRenderTest.php \Drupal\Tests\views\Kernel\ViewRenderTest
Tests general rendering of a view.
@group views
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertLegacyTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\Tests\views\Kernel\ViewsKernelTestBase uses \Drupal\views\Tests\ViewResultAssertionTrait implements \Drupal\KernelTests\KernelTestBase
- class \Drupal\Tests\views\Kernel\ViewRenderTest implements \Drupal\Tests\views\Kernel\ViewsKernelTestBase
- class \Drupal\Tests\views\Kernel\ViewsKernelTestBase uses \Drupal\views\Tests\ViewResultAssertionTrait implements \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of ViewRenderTest
File
-
core/
modules/ views/ tests/ src/ Kernel/ ViewRenderTest.php, line 12
Namespace
Drupal\Tests\views\KernelView 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'));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.