function CounterTest::setUp
Same name in other branches
- 9 core/modules/views/tests/src/Unit/Plugin/field/CounterTest.php \Drupal\Tests\views\Unit\Plugin\field\CounterTest::setUp()
- 8.9.x core/modules/views/tests/src/Unit/Plugin/field/CounterTest.php \Drupal\Tests\views\Unit\Plugin\field\CounterTest::setUp()
- 10 core/modules/views/tests/src/Unit/Plugin/field/CounterTest.php \Drupal\Tests\views\Unit\Plugin\field\CounterTest::setUp()
Overrides UnitTestCase::setUp
File
-
core/
modules/ views/ tests/ src/ Unit/ Plugin/ field/ CounterTest.php, line 59
Class
- CounterTest
- @coversDefaultClass \Drupal\views\Plugin\views\field\Counter @group views
Namespace
Drupal\Tests\views\Unit\Plugin\fieldCode
protected function setUp() : void {
parent::setUp();
// Setup basic stuff like the view and the display.
$config = [];
$config['display']['default'] = [
'id' => 'default',
'display_plugin' => 'default',
'display_title' => 'Default',
];
$storage = new View($config, 'view');
$user = $this->createMock('Drupal\\Core\\Session\\AccountInterface');
$views_data = $this->getMockBuilder('Drupal\\views\\ViewsData')
->disableOriginalConstructor()
->getMock();
$route_provider = $this->createMock('Drupal\\Core\\Routing\\RouteProviderInterface');
$display_plugin_manager = $this->getMockBuilder('\\Drupal\\views\\Plugin\\ViewsPluginManager')
->disableOriginalConstructor()
->getMock();
$this->view = new ViewExecutable($storage, $user, $views_data, $route_provider, $display_plugin_manager);
$this->display = $this->getMockBuilder('Drupal\\views\\Plugin\\views\\display\\DisplayPluginBase')
->disableOriginalConstructor()
->getMock();
$this->pager = $this->getMockBuilder('Drupal\\views\\Plugin\\views\\pager\\Full')
->disableOriginalConstructor()
->onlyMethods([])
->getMock();
$this->view->display_handler = $this->display;
$this->view->pager = $this->pager;
foreach (ViewTestData::dataSet() as $index => $set) {
$this->testData[] = new ResultRow($set + [
'index' => $index,
]);
}
$this->definition = [
'title' => 'counter field',
'plugin_type' => 'field',
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.