Upgraded drupal core with security updates
[yaffs-website] / web / core / modules / views / tests / src / Unit / Plugin / HandlerTestTrait.php
1 <?php
2
3 namespace Drupal\Tests\views\Unit\Plugin;
4
5 /**
6  * Test trait to mock dependencies of a handler.
7  */
8 trait HandlerTestTrait {
9
10   /**
11    * The mocked view entity.
12    *
13    * @var \Drupal\views\Entity\View|\PHPUnit_Framework_MockObject_MockObject
14    */
15   protected $view;
16
17   /**
18    * The mocked view executable.
19    *
20    * @var \Drupal\views\ViewExecutable|\PHPUnit_Framework_MockObject_MockObject
21    */
22   protected $executable;
23
24   /**
25    * The mocked views data.
26    *
27    * @var \Drupal\views\ViewsData|\PHPUnit_Framework_MockObject_MockObject
28    */
29   protected $viewsData;
30
31   /**
32    * The mocked display.
33    *
34    * @var \Drupal\views\Plugin\views\display\DisplayPluginBase|\PHPUnit_Framework_MockObject_MockObject
35    */
36   protected $display;
37
38   /**
39    * Sets up a view executable and a view entity.
40    */
41   protected function setupExecutableAndView() {
42     $this->view = $this->getMockBuilder('Drupal\views\Entity\View')
43       ->disableOriginalConstructor()
44       ->getMock();
45     $this->executable = $this->getMockBuilder('Drupal\views\ViewExecutable')
46       ->disableOriginalConstructor()
47       ->getMock();
48     $this->executable->storage = $this->view;
49   }
50
51   /**
52    * Sets up a mocked views data object.
53    */
54   protected function setupViewsData() {
55     $this->viewsData = $this->getMockBuilder('Drupal\views\ViewsData')
56       ->disableOriginalConstructor()
57       ->getMock();
58   }
59
60   /**
61    * Sets up a mocked display object.
62    */
63   protected function setupDisplay() {
64     $this->display = $this->getMockBuilder('Drupal\views\Plugin\views\display\DisplayPluginBase')
65       ->disableOriginalConstructor()
66       ->getMock();
67   }
68
69 }