trait HandlerTestTrait in Drupal 8
Same name and namespace in other branches
- 9 core/modules/views/tests/src/Unit/Plugin/HandlerTestTrait.php \Drupal\Tests\views\Unit\Plugin\HandlerTestTrait
- 10 core/modules/views/tests/src/Unit/Plugin/HandlerTestTrait.php \Drupal\Tests\views\Unit\Plugin\HandlerTestTrait
Test trait to mock dependencies of a handler.
Hierarchy
- trait \Drupal\Tests\views\Unit\Plugin\HandlerTestTrait
1 file declares its use of HandlerTestTrait
- FieldTest.php in core/
modules/ views/ tests/ src/ Unit/ Plugin/ field/ FieldTest.php - Contains \Drupal\Tests\views\Unit\Plugin\field\FieldTest.
File
- core/
modules/ views/ tests/ src/ Unit/ Plugin/ HandlerTestTrait.php, line 8
Namespace
Drupal\Tests\views\Unit\PluginView source
trait HandlerTestTrait {
/**
* The mocked view entity.
*
* @var \Drupal\views\Entity\View|\PHPUnit\Framework\MockObject\MockObject
*/
protected $view;
/**
* The mocked view executable.
*
* @var \Drupal\views\ViewExecutable|\PHPUnit\Framework\MockObject\MockObject
*/
protected $executable;
/**
* The mocked views data.
*
* @var \Drupal\views\ViewsData|\PHPUnit\Framework\MockObject\MockObject
*/
protected $viewsData;
/**
* The mocked display.
*
* @var \Drupal\views\Plugin\views\display\DisplayPluginBase|\PHPUnit\Framework\MockObject\MockObject
*/
protected $display;
/**
* Sets up a view executable and a view entity.
*/
protected function setupExecutableAndView() {
$this->view = $this
->getMockBuilder('Drupal\\views\\Entity\\View')
->disableOriginalConstructor()
->getMock();
$this->executable = $this
->getMockBuilder('Drupal\\views\\ViewExecutable')
->disableOriginalConstructor()
->getMock();
$this->executable->storage = $this->view;
}
/**
* Sets up a mocked views data object.
*/
protected function setupViewsData() {
$this->viewsData = $this
->getMockBuilder('Drupal\\views\\ViewsData')
->disableOriginalConstructor()
->getMock();
}
/**
* Sets up a mocked display object.
*/
protected function setupDisplay() {
$this->display = $this
->getMockBuilder('Drupal\\views\\Plugin\\views\\display\\DisplayPluginBase')
->disableOriginalConstructor()
->getMock();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
HandlerTestTrait:: |
protected | property | The mocked display. | |
HandlerTestTrait:: |
protected | property | The mocked view executable. | |
HandlerTestTrait:: |
protected | property | The mocked view entity. | |
HandlerTestTrait:: |
protected | property | The mocked views data. | |
HandlerTestTrait:: |
protected | function | Sets up a mocked display object. | |
HandlerTestTrait:: |
protected | function | Sets up a view executable and a view entity. | |
HandlerTestTrait:: |
protected | function | Sets up a mocked views data object. |