public function ViewsTemplateTest::testTemplate in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/src/Tests/ViewsTemplateTest.php \Drupal\views\Tests\ViewsTemplateTest::testTemplate()
Tests render functionality.
File
- core/
modules/ views/ src/ Tests/ ViewsTemplateTest.php, line 40 - Contains \Drupal\views\Tests\ViewsTemplateTest.
Class
- ViewsTemplateTest
- Tests the template retrieval of views.
Namespace
Drupal\views\TestsCode
public function testTemplate() {
// Make sure that the rendering just calls the preprocess function once.
$view = Views::getView('test_view_display_template');
$output = $view
->preview();
// Check if we got the rendered output of our template file.
$this
->assertTrue(strpos(\Drupal::service('renderer')
->renderRoot($output), 'This module defines its own display template.') !== FALSE, 'Display plugin DisplayTemplateTest defines its own template.');
}