Mercurial > hg > isophonics-drupal-site
comparison core/modules/views/tests/src/Functional/ViewsTemplateTest.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\Tests\views\Functional; | |
4 | |
5 use Drupal\views\Tests\ViewTestData; | |
6 use Drupal\views\Views; | |
7 | |
8 /** | |
9 * Tests the template retrieval of views. | |
10 * | |
11 * @group views | |
12 * @see \Drupal\views_test_data\Plugin\views\style\StyleTemplateTest | |
13 */ | |
14 class ViewsTemplateTest extends ViewTestBase { | |
15 | |
16 /** | |
17 * Views used by this test. | |
18 * | |
19 * @var array | |
20 */ | |
21 public static $testViews = ['test_view_display_template']; | |
22 | |
23 /** | |
24 * {@inheritdoc} | |
25 */ | |
26 protected function setUp($import_test_views = TRUE) { | |
27 parent::setUp(FALSE); | |
28 | |
29 $this->enableViewsTestModule(); | |
30 ViewTestData::createTestViews(get_class($this), ['views_test_config']); | |
31 } | |
32 | |
33 /** | |
34 * Tests render functionality. | |
35 */ | |
36 public function testTemplate() { | |
37 | |
38 // Make sure that the rendering just calls the preprocess function once. | |
39 $view = Views::getView('test_view_display_template'); | |
40 $output = $view->preview(); | |
41 | |
42 // Check if we got the rendered output of our template file. | |
43 $this->assertTrue(strpos(\Drupal::service('renderer')->renderRoot($output), 'This module defines its own display template.') !== FALSE, 'Display plugin DisplayTemplateTest defines its own template.'); | |
44 | |
45 } | |
46 | |
47 } |