.../views/src/Tests/Handler/AreaViewTest.php | 2 +- core/modules/views/src/Tests/ViewTestData.php | 9 ++--- core/modules/views/src/Tests/ViewUnitTestBase.php | 12 +++++-- .../test_views/views.view.test_tag_cache.yml | 39 ---------------------- 4 files changed, 15 insertions(+), 47 deletions(-) diff --git a/core/modules/views/src/Tests/Handler/AreaViewTest.php b/core/modules/views/src/Tests/Handler/AreaViewTest.php index 16bd12e..7f93855 100644 --- a/core/modules/views/src/Tests/Handler/AreaViewTest.php +++ b/core/modules/views/src/Tests/Handler/AreaViewTest.php @@ -30,7 +30,7 @@ class AreaViewTest extends ViewUnitTestBase { * * @var array */ - public static $testViews = array('test_area_view', 'test_simple_argument'); + public static $testViews = array('test_simple_argument', 'test_area_view'); /** * Tests the view area handler. diff --git a/core/modules/views/src/Tests/ViewTestData.php b/core/modules/views/src/Tests/ViewTestData.php index 97f2d66..03c4bae 100644 --- a/core/modules/views/src/Tests/ViewTestData.php +++ b/core/modules/views/src/Tests/ViewTestData.php @@ -23,7 +23,7 @@ class ViewTestData { * Create test views from config. * * @param string $class - * The name of the test class. + * The name of the test class. Installs the listed test views *in order*. * @param array $modules * The module directories to look in for test views. */ @@ -45,9 +45,10 @@ public static function createTestViews($class, array $modules) { } $file_storage = new FileStorage($config_dir); - foreach ($file_storage->listAll('views.view.') as $config_name) { - $id = str_replace('views.view.', '', $config_name); - if (in_array($id, $views)) { + $available_views = $file_storage->listAll('views.view.'); + foreach ($views as $id) { + $config_name = 'views.view.' . $id; + if (in_array($config_name, $available_views)) { $storage ->create($file_storage->read($config_name)) ->save(); diff --git a/core/modules/views/src/Tests/ViewUnitTestBase.php b/core/modules/views/src/Tests/ViewUnitTestBase.php index a5bdd3e..6bbd44f 100644 --- a/core/modules/views/src/Tests/ViewUnitTestBase.php +++ b/core/modules/views/src/Tests/ViewUnitTestBase.php @@ -53,6 +53,15 @@ protected function setUp() { * using it, it cannot be enabled normally. */ protected function setUpFixtures() { + // First install the system module first; many Views have Page displays that + // have associated menu links, for those to work, the system menus must + // already be present. + // @todo Get rid of ViewTestData::createTestViews, in favor of fixing the + // config dependencies in all tested view config entities, which will then + // allow us to use ConfigInstaller instead, which automatically handles + // dependencies. + $this->installConfig(array('system')); + // Define the schema and views data variable before enabling the test module. \Drupal::state()->set('views_test_data_schema', $this->schemaDefinition()); \Drupal::state()->set('views_test_data_views_data', $this->viewsData()); @@ -75,9 +84,6 @@ protected function setUpFixtures() { } $query->execute(); - // Tests implementing ViewUnitTestBase depend on the theme system being - // properly configured. - $this->installConfig(array('system')); ViewTestData::createTestViews(get_class($this), array('views_test_config')); } diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_tag_cache.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_tag_cache.yml index b83e7a8..ae2ccc5 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_tag_cache.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_tag_cache.yml @@ -53,45 +53,6 @@ display: hide_alter_empty: true link_to_node: true plugin_id: node - filters: - type: - id: type - table: node_field_data - field: type - relationship: none - group_type: group - admin_label: '' - operator: in - value: - page: page - group: 1 - exposed: false - expose: - operator_id: '' - label: '' - description: '' - use_operator: false - operator: '' - identifier: '' - required: false - remember: false - multiple: false - remember_roles: - authenticated: authenticated - reduce: false - is_grouped: false - group_info: - label: '' - description: '' - identifier: '' - optional: true - widget: select - multiple: false - remember: false - default_group: All - default_group_multiple: { } - group_items: { } - plugin_id: bundle group_by: true pager: type: some