diff --git a/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_field_filters.yml b/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_field_filters.yml index 3d0bec3..1ce66e1 100644 --- a/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_field_filters.yml +++ b/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_field_filters.yml @@ -100,6 +100,7 @@ display: empty: '' hide_alter_empty: true link_to_entity: false + plugin_id: comment filters: subject: id: subject diff --git a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_field_filters.yml b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_field_filters.yml index 213689a..409f16f 100644 --- a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_field_filters.yml +++ b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_field_filters.yml @@ -73,7 +73,7 @@ display: html: false hide_empty: false empty_zero: false - link_to_node: 1 + link_to_node: true relationship: none group_type: group admin_label: '' @@ -88,6 +88,7 @@ display: element_default_classes: true empty: '' hide_alter_empty: true + plugin_id: node filters: status: value: true @@ -97,6 +98,7 @@ display: expose: operator: '' group: 1 + plugin_id: boolean title: id: title table: node_field_data @@ -179,6 +181,7 @@ display: expose: operator: '' group: 1 + plugin_id: boolean body_value: id: body_value table: node__body @@ -243,6 +246,7 @@ display: expose: operator: '' group: 1 + plugin_id: boolean body_value: id: body_value table: node__body @@ -307,6 +311,7 @@ display: expose: operator: '' group: 1 + plugin_id: boolean title: id: title table: node_field_data diff --git a/core/modules/views/config/schema/views.access.schema.yml b/core/modules/views/config/schema/views.access.schema.yml index c09edef..dac0100 100644 --- a/core/modules/views/config/schema/views.access.schema.yml +++ b/core/modules/views/config/schema/views.access.schema.yml @@ -1,7 +1,5 @@ # Schema for the views access plugins. views.access.none: - type: sequence + type: mapping label: 'None' - sequence: - - type: string diff --git a/core/modules/views/config/schema/views.schema.yml b/core/modules/views/config/schema/views.schema.yml index 61a6ea5..6243b46 100644 --- a/core/modules/views/config/schema/views.schema.yml +++ b/core/modules/views/config/schema/views.schema.yml @@ -115,7 +115,7 @@ views.view.*: display_options: type: views.display.[%parent.display_plugin] -block.settings.views_block:*: +views_block: type: block_settings label: 'View block' mapping: @@ -125,3 +125,9 @@ block.settings.views_block:*: items_per_page: type: string label: 'Items per block' + +block.settings.views_block:*: + type: views_block + +block.settings.views_exposed_filter_block:*: + type: views_block diff --git a/core/modules/views/src/Tests/Handler/AreaTest.php b/core/modules/views/src/Tests/Handler/AreaTest.php index 0df2ce0..cece05c 100644 --- a/core/modules/views/src/Tests/Handler/AreaTest.php +++ b/core/modules/views/src/Tests/Handler/AreaTest.php @@ -166,6 +166,7 @@ public function testTitleArea() { 'admin_label' => '', 'empty' => '0', 'title' => 'Overridden title', + 'plugin_id' => 'title', ), )); diff --git a/core/modules/views/src/Tests/Plugin/BlockDependenciesTest.php b/core/modules/views/src/Tests/Plugin/BlockDependenciesTest.php index d8a0b56..b7ece54 100644 --- a/core/modules/views/src/Tests/Plugin/BlockDependenciesTest.php +++ b/core/modules/views/src/Tests/Plugin/BlockDependenciesTest.php @@ -100,13 +100,14 @@ protected function createBlock($plugin_id, array $settings = array()) { 'max_age' => 0, ), ); - foreach (array('region', 'id', 'theme', 'plugin', 'weight') as $key) { + $values = []; + foreach (array('region', 'id', 'theme', 'plugin', 'weight', 'visibility') as $key) { $values[$key] = $settings[$key]; // Remove extra values that do not belong in the settings array. unset($settings[$key]); } - foreach ($settings['visibility'] as $id => $visibility) { - $settings['visibility'][$id]['id'] = $id; + foreach ($values['visibility'] as $id => $visibility) { + $values['visibility'][$id]['id'] = $id; } $values['settings'] = $settings; $block = entity_create('block', $values); diff --git a/core/modules/views/src/Tests/ViewElementTest.php b/core/modules/views/src/Tests/ViewElementTest.php index c0b7829..ec85538 100644 --- a/core/modules/views/src/Tests/ViewElementTest.php +++ b/core/modules/views/src/Tests/ViewElementTest.php @@ -89,11 +89,12 @@ public function testViewElement() { 'type' => 'none', 'fail' => 'not found', ), - 'break_phrase' => 0, - 'not' => 0, + 'break_phrase' => FALSE, + 'not' => FALSE, 'id' => 'age', 'table' => 'views_test_data', 'field' => 'age', + 'plugin_id' => 'numeric', ) )); $view->save(); diff --git a/core/modules/views/src/Tests/ViewStorageTest.php b/core/modules/views/src/Tests/ViewStorageTest.php index 19ec50e..36846de 100644 --- a/core/modules/views/src/Tests/ViewStorageTest.php +++ b/core/modules/views/src/Tests/ViewStorageTest.php @@ -233,14 +233,12 @@ protected function displayMethodTests() { $this->assertEqual($display[$id]['display_title'], 'Page 3'); // Ensure the 'default' display always has position zero, regardless of when - // it was created relative to other displays. - $displays = $view->get('display'); - $displays['default']['deleted'] = TRUE; - $view->set('display', $displays); - $view->set('id', $this->randomMachineName()); - $view->save(); + // it was set relative to other displays. Even if the 'default' display + // exists, adding it again will overwrite it, which is asserted with the new + // title. $view->addDisplay('default', $random_title); $displays = $view->get('display'); + $this->assertEqual($displays['default']['display_title'], $random_title, 'Default display is defined with the new title'); $this->assertEqual($displays['default']['position'], 0, 'Default displays are always in position zero'); // Tests Drupal\views\Entity\View::generateDisplayId(). diff --git a/core/modules/views/src/Tests/ViewTestBase.php b/core/modules/views/src/Tests/ViewTestBase.php index c33776d..b7ab8c1 100644 --- a/core/modules/views/src/Tests/ViewTestBase.php +++ b/core/modules/views/src/Tests/ViewTestBase.php @@ -24,6 +24,15 @@ abstract class ViewTestBase extends WebTestBase { /** + * Set to TRUE to strict check all configuration saved. + * + * @see \Drupal\Core\Config\Testing\ConfigSchemaChecker + * + * @var bool + */ + protected $strictConfigSchema = TRUE; + + /** * Modules to enable. * * @var array diff --git a/core/modules/views/src/Tests/ViewUnitTestBase.php b/core/modules/views/src/Tests/ViewUnitTestBase.php index 0d07484..a5bdd3e 100644 --- a/core/modules/views/src/Tests/ViewUnitTestBase.php +++ b/core/modules/views/src/Tests/ViewUnitTestBase.php @@ -25,6 +25,15 @@ abstract class ViewUnitTestBase extends KernelTestBase { /** + * Set to TRUE to strict check all configuration saved. + * + * @see \Drupal\Core\Config\Testing\ConfigSchemaChecker + * + * @var bool + */ + protected $strictConfigSchema = TRUE; + + /** * Modules to enable. * * @var array diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_defaults.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_defaults.yml index 73463bf..af8b888 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_defaults.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_defaults.yml @@ -48,5 +48,6 @@ display: table: views_test_data field: created order: DESC + plugin_id: date field_langcode: '***LANGUAGE_language_content***' field_langcode_add_to_query: null diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_views_groupby_save.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_views_groupby_save.yml index 30b059b..f2d15cf 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_views_groupby_save.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_views_groupby_save.yml @@ -29,7 +29,7 @@ display: field: id table: views_test_data id: id - plugin_id: id + plugin_id: numeric field_langcode: '***LANGUAGE_language_content***' field_langcode_add_to_query: null display_plugin: default diff --git a/core/modules/views/tests/modules/views_test_data/config/schema/views_test_data.views.schema.yml b/core/modules/views/tests/modules/views_test_data/config/schema/views_test_data.views.schema.yml index 4b51a2b..b67e87f 100644 --- a/core/modules/views/tests/modules/views_test_data/config/schema/views_test_data.views.schema.yml +++ b/core/modules/views/tests/modules/views_test_data/config/schema/views_test_data.views.schema.yml @@ -26,3 +26,62 @@ views.style.mapping_test: toggle_title_field: type: boolean label: 'Toggle title field' + +views_test_data.tests: + type: mapping + label: 'Views test data tests' + mapping: + handler_access_callback: + type: boolean + label: 'Access callback handler toggle' + handler_access_callback_argument: + type: boolean + label: 'Access callback argument handler toggle' + +views.access.test_static: + type: mapping + label: 'Static test' + mapping: + access: + type: boolean + label: 'Allow access' + +views.display.display_test: + type: views_display + label: 'Test display options' + mapping: + test_option: + label: 'Test option' + type: string + +views.display.invalid: + type: views.display.paeg + label: 'Invalid display' + +views.display.display_no_area_test: + type: views.display.display_test + label: 'Test display options without areas' + +views.query.query_test: + type: views_query + label: 'Views query test options' + mapping: + test_setting: + type: string + label: 'Test setting' + +views.row.test_row: + type: views_entity_row + label: 'Row test options' + mapping: + test_option: + type: string + label: 'Test option' + +views.style.test_style: + type: views_style + label: 'Test style options' + mapping: + test_option: + type: string + label: 'Test option' diff --git a/core/modules/views_ui/src/Tests/CustomBooleanTest.php b/core/modules/views_ui/src/Tests/CustomBooleanTest.php index ebf989b..f9a990b 100644 --- a/core/modules/views_ui/src/Tests/CustomBooleanTest.php +++ b/core/modules/views_ui/src/Tests/CustomBooleanTest.php @@ -57,8 +57,10 @@ public function testCustomOption() { 'table' => 'views_test_data', 'field' => 'age', 'relationship' => 'none', + 'plugin_id' => 'boolean', ), )); + $view->save(); $this->executeView($view); diff --git a/core/modules/views_ui/src/Tests/QueryTest.php b/core/modules/views_ui/src/Tests/QueryTest.php index db8bed2..bed0422 100644 --- a/core/modules/views_ui/src/Tests/QueryTest.php +++ b/core/modules/views_ui/src/Tests/QueryTest.php @@ -8,6 +8,7 @@ namespace Drupal\views_ui\Tests; use Drupal\views\Views; +use Drupal\views\Entity\View; use Drupal\views\Tests\ViewTestBase; use Drupal\views_test_data\Plugin\views\query\QueryTest as QueryTestPlugin; @@ -39,6 +40,11 @@ protected function viewsData() { * Tests query plugins settings. */ public function testQueryUI() { + $view = View::load('test_view'); + $display = &$view->getDisplay('default'); + $display['display_options']['query'] = ['type' => 'query_test']; + $view->save(); + // Save some query settings. $query_settings_path = "admin/structure/views/nojs/display/test_view/default/query"; $random_value = $this->randomMachineName();