class ViewsTemplateTest
Same name and namespace in other branches
- 11.x core/modules/views/tests/src/Kernel/ViewsTemplateTest.php \Drupal\Tests\views\Kernel\ViewsTemplateTest
- 10 core/modules/views/tests/src/Kernel/ViewsTemplateTest.php \Drupal\Tests\views\Kernel\ViewsTemplateTest
- 9 core/modules/views/tests/src/Kernel/ViewsTemplateTest.php \Drupal\Tests\views\Kernel\ViewsTemplateTest
Tests the template retrieval of views.
@group views
Hierarchy
- class \Drupal\KernelTests\KernelTestBase implements \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertLegacyTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\AssertHelperTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\PhpunitCompatibilityTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\views\Kernel\ViewsKernelTestBase uses \Drupal\views\Tests\ViewResultAssertionTrait extends \Drupal\KernelTests\KernelTestBase
- class \Drupal\Tests\views\Kernel\ViewsTemplateTest extends \Drupal\Tests\views\Kernel\ViewsKernelTestBase
- class \Drupal\Tests\views\Kernel\ViewsKernelTestBase uses \Drupal\views\Tests\ViewResultAssertionTrait extends \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of ViewsTemplateTest
See also
\Drupal\views_test_data\Plugin\views\style\StyleTemplateTest
File
-
core/
modules/ views/ tests/ src/ Kernel/ ViewsTemplateTest.php, line 14
Namespace
Drupal\Tests\views\KernelView source
class ViewsTemplateTest extends ViewsKernelTestBase {
/**
* {@inheritdoc}
*/
public static $testViews = [
'test_view_display_template',
];
/**
* Tests render functionality.
*/
public function testTemplate() {
// Make sure that the rendering just calls the preprocess function once.
$output = Views::getView('test_view_display_template')->preview();
$renderer = $this->container
->get('renderer');
// Check that the renderd output uses the correct template file.
$this->assertStringContainsString('This module defines its own display template.', (string) $renderer->renderRoot($output));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.