protected function CounterTest::setUp in Drupal 10
Same name and namespace in other branches
- 8 core/modules/views/tests/src/Unit/Plugin/field/CounterTest.php \Drupal\Tests\views\Unit\Plugin\field\CounterTest::setUp()
- 9 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 57
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');
$this->view = new ViewExecutable($storage, $user, $views_data, $route_provider);
$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',
];
}