diff --git a/core/modules/views/src/Tests/Update/Update8001Test.php b/core/modules/views/src/Tests/Update/UpdateTest.php similarity index 76% rename from core/modules/views/src/Tests/Update/Update8001Test.php rename to core/modules/views/src/Tests/Update/UpdateTest.php index afd43b2..2abf260 100644 --- a/core/modules/views/src/Tests/Update/Update8001Test.php +++ b/core/modules/views/src/Tests/Update/UpdateTest.php @@ -2,13 +2,14 @@ /** * @file - * Contains \Drupal\views\Tests\Update\Update8001Test. + * Contains \Drupal\views\Tests\Update\UpdateTest. */ namespace Drupal\views\Tests\Update; use Drupal\Core\Url; use Drupal\views\Tests\ViewTestBase; +use Drupal\views\Tests\ViewTestData; use Drupal\views\Views; /** @@ -16,7 +17,7 @@ * * @group Update */ -class Update8001Test extends ViewTestBase { +class UpdateTest extends ViewTestBase { /** * Set to FALSE to avoid strict check all configuration saved. @@ -30,14 +31,14 @@ class Update8001Test extends ViewTestBase { /** * {@inheritdoc} */ - public static $modules = ['views']; + public static $modules = ['views_test_updates']; /** * Views used by this test. * * @var array */ - public static $testViews = ['test_view_update']; + public static $testViews = ['test_view_update_8001']; /** * The user who can run updates. @@ -59,6 +60,8 @@ class Update8001Test extends ViewTestBase { public function setUp() { parent::setUp(); + ViewTestData::createTestViews(get_class($this), array('views_test_updates')); + require_once \Drupal::root() . '/core/includes/update.inc'; $this->user = $this->drupalCreateUser(['administer software updates', 'access site in maintenance mode']); $this->updateUrl = Url::fromRoute('system.db_update'); @@ -71,13 +74,12 @@ public function testUpdateHooks() { // Verify that the 8000 schema is in place. $this->assertEqual(drupal_get_installed_schema_version('views'), 8000); /* @var \Drupal\views\Entity\View $view */ - $view = Views::getView('content'); + $view = Views::getView('test_view_update'); $displays = $view->get('display'); foreach (array_keys($displays) as $display_id) { $display = $view->getDisplay($display_id); - unset($display['cache_metadata']['cacheable']); + $this->assertTrue(isset($display['cache_metadata']['cacheable'])); } - $this->assertTrue(isset($display['cache_metadata']['cacheable'])); // Increment the schema version. \Drupal::state()->set('views', 8001); @@ -85,20 +87,19 @@ public function testUpdateHooks() { $this->drupalLogin($this->user); $this->drupalGet($this->updateUrl, ['external' => TRUE]); $this->clickLink(t('Continue')); - $this->assertRaw('Schema version 8001.'); + $this->assertRaw('Update all views to re-generate the cacheability metadata.'); // Run the update hooks. $this->clickLink(t('Apply pending updates')); // Ensure schema has changed. $this->assertEqual(drupal_get_installed_schema_version('views', TRUE), 8001); /* @var \Drupal\views\Entity\View $view */ - $view = Views::getView('content'); + $view = Views::getView('test_view_update'); $displays = $view->get('display'); foreach (array_keys($displays) as $display_id) { $display = $view->getDisplay($display_id); - unset($display['cache_metadata']['cacheable']); + $this->assertFalse(isset($display['cache_metadata']['cacheable'])); } - $this->assertFalse(isset($display['cache_metadata']['cacheable'])); } } diff --git a/core/modules/views/tests/modules/views_test_updates/config/schema/views_test_updates.views.schema.yml b/core/modules/views/tests/modules/views_test_updates/config/schema/views_test_updates.views.schema.yml new file mode 100644 index 0000000..a689aad --- /dev/null +++ b/core/modules/views/tests/modules/views_test_updates/config/schema/views_test_updates.views.schema.yml @@ -0,0 +1,9 @@ +# Schema for the views plugins of the Views test updates module. + +views.view.display.cache_metadata.*: + type: views.view.display.cache_metadata + label: 'Cache metadata' + mapping: + cacheable: + type: boolean + label: 'Cacheable' diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_update.yml b/core/modules/views/tests/modules/views_test_updates/test_views/views.view.test_view_update_8001.yml similarity index 95% rename from core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_update.yml rename to core/modules/views/tests/modules/views_test_updates/test_views/views.view.test_view_update_8001.yml index ce3f76a..fcb1486 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_update.yml +++ b/core/modules/views/tests/modules/views_test_updates/test_views/views.view.test_view_update_8001.yml @@ -1,13 +1,13 @@ langcode: en status: true dependencies: { } -id: test_view_update -label: 'Test view embed' +id: test_view_update_8001 +label: 'Test view update 8001' module: views description: '' tag: '' base_table: views_test_data -base_field: '' +base_field: id core: '8' display: default: diff --git a/core/modules/views/tests/modules/views_test_updates/views_test_updates.info.yml b/core/modules/views/tests/modules/views_test_updates/views_test_updates.info.yml new file mode 100644 index 0000000..4a3540d --- /dev/null +++ b/core/modules/views/tests/modules/views_test_updates/views_test_updates.info.yml @@ -0,0 +1,8 @@ +name: 'Views Test Update' +type: module +description: 'Test Views module updates.' +package: Testing +version: VERSION +core: 8.x +dependencies: + - views