annotate core/modules/views/tests/src/Kernel/ViewsTemplateTest.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents af1871eacc83
children
rev   line source
Chris@18 1 <?php
Chris@18 2
Chris@18 3 namespace Drupal\Tests\views\Kernel;
Chris@18 4
Chris@18 5 use Drupal\views\Views;
Chris@18 6
Chris@18 7 /**
Chris@18 8 * Tests the template retrieval of views.
Chris@18 9 *
Chris@18 10 * @group views
Chris@18 11 *
Chris@18 12 * @see \Drupal\views_test_data\Plugin\views\style\StyleTemplateTest
Chris@18 13 */
Chris@18 14 class ViewsTemplateTest extends ViewsKernelTestBase {
Chris@18 15
Chris@18 16 /**
Chris@18 17 * {@inheritdic}
Chris@18 18 */
Chris@18 19 public static $testViews = ['test_view_display_template'];
Chris@18 20
Chris@18 21 /**
Chris@18 22 * Tests render functionality.
Chris@18 23 */
Chris@18 24 public function testTemplate() {
Chris@18 25 // Make sure that the rendering just calls the preprocess function once.
Chris@18 26 $output = Views::getView('test_view_display_template')->preview();
Chris@18 27 $renderer = $this->container->get('renderer');
Chris@18 28
Chris@18 29 // Check that the renderd output uses the correct template file.
Chris@18 30 $this->assertContains('This module defines its own display template.', (string) $renderer->renderRoot($output));
Chris@18 31 }
Chris@18 32
Chris@18 33 }