protected function ViewfieldFunctionalTestBase::createView in Viewfield 8.3
Create a view setup for testing Viewfield.
1 call to ViewfieldFunctionalTestBase::createView()
- ViewfieldFunctionalTestBase::setUp in tests/
src/ FunctionalJavascript/ ViewfieldFunctionalTestBase.php
File
- tests/
src/ FunctionalJavascript/ ViewfieldFunctionalTestBase.php, line 115
Class
- ViewfieldFunctionalTestBase
- Provide basic setup for all Viewfield functional tests.
Namespace
Drupal\Tests\viewfield\FunctionalJavascriptCode
protected function createView($items_per_page = 3) {
View::create([
'label' => 'Content Test',
'id' => 'content_test',
'base_table' => 'node_field_data',
'display' => [
'default' => [
'display_plugin' => 'default',
'id' => 'default',
'display_options' => [
'row' => [
'type' => 'entity:node',
'options' => [
'view_mode' => 'teaser',
],
],
'pager' => [
'type' => 'full',
'options' => [
'items_per_page' => $items_per_page,
'offset' => 0,
],
],
'use_ajax' => TRUE,
'arguments' => [
'type' => [
'id' => 'type',
'table' => 'node_field_data',
'field' => 'type',
'relationship' => 'none',
'group_type' => 'group',
'default_action' => 'ignore',
'exception' => [
'value' => 'all',
],
'default_argument_type' => 'fixed',
'entity_type' => 'node',
'entity_field' => 'type',
'plugin_id' => 'node_type',
],
],
],
],
'block_1' => [
'display_plugin' => 'block',
'id' => 'block_1',
],
],
])
->save();
\Drupal::service('router.builder')
->rebuild();
}