Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / views / tests / src / Functional / ViewRenderTest.php
1 <?php
2
3 namespace Drupal\Tests\views\Functional;
4
5 use Drupal\views\Views;
6
7 /**
8  * Tests general rendering of a view.
9  *
10  * @group views
11  */
12 class ViewRenderTest extends ViewTestBase {
13
14   /**
15    * Views used by this test.
16    *
17    * @var array
18    */
19   public static $testViews = ['test_view_render'];
20
21   protected function setUp($import_test_views = TRUE) {
22     parent::setUp($import_test_views);
23
24     $this->enableViewsTestModule();
25   }
26
27   /**
28    * Tests render functionality.
29    */
30   public function testRender() {
31     \Drupal::state()->set('views_render.test', 0);
32
33     // Make sure that the rendering just calls the preprocess function once.
34     $view = Views::getView('test_view_render');
35     $output = $view->preview();
36     $this->container->get('renderer')->renderRoot($output);
37
38     $this->assertEqual(\Drupal::state()->get('views_render.test'), 1);
39   }
40
41 }