X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fviews%2Ftests%2Fsrc%2FFunctional%2FUpdate%2FEntityViewsMultiValueBaseFieldDataUpdateTest.php;fp=web%2Fcore%2Fmodules%2Fviews%2Ftests%2Fsrc%2FFunctional%2FUpdate%2FEntityViewsMultiValueBaseFieldDataUpdateTest.php;h=44516e97a5e16be0f08e3311f68f88411bfd29bb;hp=0000000000000000000000000000000000000000;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/web/core/modules/views/tests/src/Functional/Update/EntityViewsMultiValueBaseFieldDataUpdateTest.php b/web/core/modules/views/tests/src/Functional/Update/EntityViewsMultiValueBaseFieldDataUpdateTest.php new file mode 100644 index 000000000..44516e97a --- /dev/null +++ b/web/core/modules/views/tests/src/Functional/Update/EntityViewsMultiValueBaseFieldDataUpdateTest.php @@ -0,0 +1,54 @@ +databaseDumpFiles = [ + __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz', + __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.views-entity-views-data-2846614.php', + ]; + } + + /** + * Tests multi-value base field views data is updated correctly. + */ + public function testUpdateMultiValueBaseFields() { + $this->runUpdates(); + + $view = Views::getView('test_user_multi_value'); + $display = $view->storage->get('display'); + + // Check each handler type present in the configuration to make sure the + // field got updated correctly. + foreach (['fields', 'filters', 'arguments'] as $type) { + $handler_config = $display['default']['display_options'][$type]['roles']; + + // The ID should remain unchanged. Otherwise the update handler could + // overwrite a separate handler config. + $this->assertEqual('roles', $handler_config['id']); + // The field should be updated from 'roles' to the correct column name. + $this->assertEqual('roles_target_id', $handler_config['field']); + // Check the table is still correct. + $this->assertEqual('user__roles', $handler_config['table']); + + // The plugin ID should be updated as well. + $this->assertEqual($type === 'arguments' ? 'user__roles_rid' : 'user_roles', $handler_config['plugin_id']); + } + } + +}