diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php index 9948c74..c06f8c5 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php @@ -58,11 +58,6 @@ class ConfigEntityType extends EntityType { /** * {@inheritdoc} */ - protected $static_cache = FALSE; - - /** - * {@inheritdoc} - */ public function __construct($definition) { parent::__construct($definition); // Always add a default 'uuid' key. diff --git a/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php b/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php index 57041e9..51a0c0d 100644 --- a/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php +++ b/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php @@ -109,7 +109,9 @@ public static function collectRenderDisplays($entities, $view_mode) { foreach ($bundles as $bundle) { // Use the selected display if any, or create a fresh runtime object. if (isset($load_ids[$bundle])) { - $display = $displays[$load_ids[$bundle]]; + // The display might be altered during the request, clone to so that + // those changes will not affect anything else. + $display = clone $displays[$load_ids[$bundle]]; } else { $display = $storage->create(array( diff --git a/core/lib/Drupal/Core/Entity/EntityDatabaseStorage.php b/core/lib/Drupal/Core/Entity/EntityDatabaseStorage.php index b55736d..5200f6f 100644 --- a/core/lib/Drupal/Core/Entity/EntityDatabaseStorage.php +++ b/core/lib/Drupal/Core/Entity/EntityDatabaseStorage.php @@ -154,9 +154,6 @@ protected function doDelete($entities) { $this->database->delete($this->entityType->getBaseTable()) ->condition($this->idKey, $ids, 'IN') ->execute(); - - // Reset the cache as soon as the changes have been applied. - $this->resetCache($ids); } /** diff --git a/core/modules/block/src/Tests/Views/DisplayBlockTest.php b/core/modules/block/src/Tests/Views/DisplayBlockTest.php index 3c0deab..785df29 100644 --- a/core/modules/block/src/Tests/Views/DisplayBlockTest.php +++ b/core/modules/block/src/Tests/Views/DisplayBlockTest.php @@ -221,6 +221,7 @@ public function testViewsBlockForm() { $edit['settings[override][items_per_page]'] = 5; $this->drupalPostForm('admin/structure/block/manage/views_block__test_view_block_block_1_4', $edit, t('Save block')); + $storage->resetCache(); $block = $storage->load('views_block__test_view_block_block_1_4'); $config = $block->getPlugin()->getConfiguration(); diff --git a/core/modules/ckeditor/src/Tests/CKEditorAdminTest.php b/core/modules/ckeditor/src/Tests/CKEditorAdminTest.php index 7a0fd65..a956267 100644 --- a/core/modules/ckeditor/src/Tests/CKEditorAdminTest.php +++ b/core/modules/ckeditor/src/Tests/CKEditorAdminTest.php @@ -137,6 +137,7 @@ function testExistingFormat() { ); $this->drupalPostForm(NULL, $edit, t('Save configuration')); $expected_settings['plugins']['stylescombo']['styles'] = "h1.title|Title\np.callout|Callout\n\n"; + \Drupal::entityManager()->getStorage('editor')->resetCache(); $editor = entity_load('editor', 'filtered_html'); $this->assertTrue($editor instanceof Editor, 'An Editor config entity exists.'); $this->assertIdentical($expected_settings, $editor->getSettings(), 'The Editor config entity has the correct settings.'); @@ -154,6 +155,7 @@ function testExistingFormat() { 'editor[settings][toolbar][button_groups]' => json_encode($expected_settings['toolbar']['rows']), ); $this->drupalPostForm(NULL, $edit, t('Save configuration')); + \Drupal::entityManager()->getStorage('editor')->resetCache(); $editor = entity_load('editor', 'filtered_html'); $this->assertTrue($editor instanceof Editor, 'An Editor config entity exists.'); $this->assertIdentical($expected_settings, $editor->getSettings(), 'The Editor config entity has the correct settings.'); @@ -180,6 +182,7 @@ function testExistingFormat() { $ultra_llama_mode_checkbox = $this->xpath('//input[@type="checkbox" and @name="editor[settings][plugins][llama_contextual_and_button][ultra_llama_mode]" and @checked="checked"]'); $this->assertTrue(count($ultra_llama_mode_checkbox) === 1, 'The "Ultra llama mode" checkbox exists and is checked.'); $expected_settings['plugins']['llama_contextual_and_button']['ultra_llama_mode'] = 1; + \Drupal::entityManager()->getStorage('editor')->resetCache(); $editor = entity_load('editor', 'filtered_html'); $this->assertTrue($editor instanceof Editor, 'An Editor config entity exists.'); $this->assertIdentical($expected_settings, $editor->getSettings()); diff --git a/core/modules/contact/src/Tests/ContactSitewideTest.php b/core/modules/contact/src/Tests/ContactSitewideTest.php index 436b2bf..0247be4 100644 --- a/core/modules/contact/src/Tests/ContactSitewideTest.php +++ b/core/modules/contact/src/Tests/ContactSitewideTest.php @@ -408,6 +408,7 @@ function deleteContactForms() { else { $this->drupalPostForm("admin/structure/contact/manage/$id/delete", array(), t('Delete')); $this->assertRaw(t('Contact form %label has been deleted.', array('%label' => $contact_form->label()))); + \Drupal::entityManager()->getStorage('contact_form')->resetCache(); $this->assertFalse(entity_load('contact_form', $id), format_string('Form %contact_form not found', array('%contact_form' => $contact_form->label()))); } } diff --git a/core/modules/field_ui/src/Tests/ManageDisplayTest.php b/core/modules/field_ui/src/Tests/ManageDisplayTest.php index 24ccc7d..8105350 100644 --- a/core/modules/field_ui/src/Tests/ManageDisplayTest.php +++ b/core/modules/field_ui/src/Tests/ManageDisplayTest.php @@ -83,6 +83,7 @@ function testFormatterUI() { // Submit the form and check that the display is updated. $this->drupalPostForm(NULL, array(), t('Save')); + \Drupal::entityManager()->getStorage('entity_view_display')->resetCache(); $display = entity_get_display('node', $this->type, 'default'); $display_options = $display->getComponent('field_test'); $current_format = $display_options['type']; @@ -195,6 +196,7 @@ public function testWidgetUI() { // Submit the form and check that the display is updated. $this->drupalPostForm(NULL, array(), t('Save')); + \Drupal::entityManager()->getStorage('entity_form_display')->resetCache(); $display = entity_get_form_display('node', $this->type, 'default'); $display_options = $display->getComponent('field_test'); $current_widget = $display_options['type']; @@ -433,6 +435,8 @@ function assertNodeViewTextHelper(EntityInterface $node, $view_mode, $text, $mes // Make sure caches on the tester side are refreshed after changes // submitted on the tested side. \Drupal::entityManager()->clearCachedFieldDefinitions(); + \Drupal::entityManager()->getStorage('entity_view_display')->resetCache(); + \Drupal::entityManager()->getStorage('entity_form_display')->resetCache(); // Save current content so that we can restore it when we're done. $old_content = $this->drupalGetContent(); diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module index 3fa834b..8916093 100644 --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -306,6 +306,7 @@ function filter_formats(AccountInterface $account = NULL) { */ function filter_formats_reset() { drupal_static_reset('filter_formats'); + \Drupal::entityManager()->getStorage('filter_format')->resetCache(); } /** diff --git a/core/modules/filter/src/Tests/FilterAdminTest.php b/core/modules/filter/src/Tests/FilterAdminTest.php index 393b705..1ddf1a2 100644 --- a/core/modules/filter/src/Tests/FilterAdminTest.php +++ b/core/modules/filter/src/Tests/FilterAdminTest.php @@ -220,6 +220,7 @@ function testFilterAdmin() { )); $this->assertTrue(!empty($elements), 'Reorder confirmed in admin interface.'); + \Drupal::entityManager()->getStorage('filter_format')->resetCache(); $filter_format = entity_load('filter_format', $restricted); foreach ($filter_format->filters() as $filter_name => $filter) { if ($filter_name == $second_filter || $filter_name == $first_filter) { diff --git a/core/modules/forum/src/Tests/ForumTest.php b/core/modules/forum/src/Tests/ForumTest.php index ebda138..9342ca0 100644 --- a/core/modules/forum/src/Tests/ForumTest.php +++ b/core/modules/forum/src/Tests/ForumTest.php @@ -331,6 +331,9 @@ function editForumVocabulary() { $this->assertResponse(200); $this->assertRaw(t('Updated vocabulary %name.', array('%name' => $edit['name'])), 'Vocabulary was edited'); + // Reset cache. + \Drupal::entityManager()->getStorage('taxonomy_vocabulary')->resetCache(); + // Grab the newly edited vocabulary. $current_vocabulary = entity_load('taxonomy_vocabulary', $vid); diff --git a/core/modules/image/src/Tests/ImageAdminStylesTest.php b/core/modules/image/src/Tests/ImageAdminStylesTest.php index d998883..a0287f9 100644 --- a/core/modules/image/src/Tests/ImageAdminStylesTest.php +++ b/core/modules/image/src/Tests/ImageAdminStylesTest.php @@ -253,6 +253,9 @@ function testStyle() { // Delete the style. $this->drupalPostForm($style_path . '/delete', array(), t('Delete')); + // Reset cache. + \Drupal::entityManager()->getStorage('image_style')->resetCache(); + // Confirm the style directory has been removed. $directory = file_default_scheme() . '://styles/' . $style_name; $this->assertFalse(is_dir($directory), format_string('Image style %style directory removed on style deletion.', array('%style' => $style->label()))); diff --git a/core/modules/image/src/Tests/ImageFieldDefaultImagesTest.php b/core/modules/image/src/Tests/ImageFieldDefaultImagesTest.php index 38fc142..109c17e 100644 --- a/core/modules/image/src/Tests/ImageFieldDefaultImagesTest.php +++ b/core/modules/image/src/Tests/ImageFieldDefaultImagesTest.php @@ -222,6 +222,9 @@ public function testDefaultImages() { ) ); + // Reset cache. + \Drupal::entityManager()->getStorage('entity_view_display')->resetCache(); + // Reload the nodes. $article_built = $this->drupalBuildEntityView($article = node_load($article->id(), TRUE)); $page_built = $this->drupalBuildEntityView($page = node_load($page->id(), TRUE)); @@ -257,6 +260,9 @@ public function testDefaultImages() { 'Updated article image field instance default has been successfully removed.' ); + // Reset cache. + \Drupal::entityManager()->getStorage('entity_view_display')->resetCache(); + // Reload the nodes. $article_built = $this->drupalBuildEntityView($article = node_load($article->id(), TRUE)); $page_built = $this->drupalBuildEntityView($page = node_load($page->id(), TRUE)); diff --git a/core/modules/menu_ui/src/Tests/MenuTest.php b/core/modules/menu_ui/src/Tests/MenuTest.php index 09bc6f4..40586d3 100644 --- a/core/modules/menu_ui/src/Tests/MenuTest.php +++ b/core/modules/menu_ui/src/Tests/MenuTest.php @@ -215,6 +215,10 @@ function deleteCustomMenu() { // Delete custom menu. $this->drupalPostForm("admin/structure/menu/manage/$menu_name/delete", array(), t('Delete')); + + // Reset cache. + \Drupal::entityManager()->getStorage('menu')->resetCache(); + $this->assertResponse(200); $this->assertRaw(t('The custom menu %title has been deleted.', array('%title' => $label)), 'Custom menu was deleted'); $this->assertNull(Menu::load($menu_name), 'Custom menu was deleted'); diff --git a/core/modules/options/src/Tests/OptionsFieldTest.php b/core/modules/options/src/Tests/OptionsFieldTest.php index 8832326..1549c6b 100644 --- a/core/modules/options/src/Tests/OptionsFieldTest.php +++ b/core/modules/options/src/Tests/OptionsFieldTest.php @@ -54,6 +54,10 @@ function testUpdateAllowedValues() { // Removed options do not appear. $this->fieldStorage->settings['allowed_values'] = array(2 => 'Two'); $this->fieldStorage->save(); + + // Reset cache. + \Drupal::entityManager()->getStorage('entity_form_display')->resetCache(); + $entity = entity_create('entity_test'); $form = \Drupal::service('entity.form_builder')->getForm($entity); $this->assertTrue(empty($form[$this->fieldName]['widget'][1]), 'Option 1 does not exist'); @@ -63,6 +67,10 @@ function testUpdateAllowedValues() { // Completely new options appear. $this->fieldStorage->settings['allowed_values'] = array(10 => 'Update', 20 => 'Twenty'); $this->fieldStorage->save(); + + // Reset cache. + \Drupal::entityManager()->getStorage('entity_form_display')->resetCache(); + // The entity holds an outdated field object with the old allowed values // setting, so we need to reintialize the entity object. $entity = entity_create('entity_test'); diff --git a/core/modules/path/src/Tests/PathLanguageTest.php b/core/modules/path/src/Tests/PathLanguageTest.php index d6399a0..929afff 100644 --- a/core/modules/path/src/Tests/PathLanguageTest.php +++ b/core/modules/path/src/Tests/PathLanguageTest.php @@ -60,6 +60,8 @@ protected function setUp() { ); $this->drupalPostForm('admin/config/regional/content-language', $edit, t('Save')); + // Reset cache. + \Drupal::entityManager()->getStorage('field_config')->resetCache(); $definitions = \Drupal::entityManager()->getFieldDefinitions('node', 'page'); $this->assertTrue($definitions['path']->isTranslatable(), 'Node path is translatable.'); $this->assertTrue($definitions['body']->isTranslatable(), 'Node body is translatable.'); @@ -131,6 +133,9 @@ function testAliasTranslation() { $edit = array('preferred_langcode' => 'fr'); $this->drupalPostForm("user/" . $this->web_user->id() . "/edit", $edit, t('Save')); + // Reset cache. + \Drupal::entityManager()->getStorage('node')->resetCache(); + // Check that the English alias works. In this situation French is the // current UI and content language, while URL language is English (since we // do not have a path prefix we fall back to the site's default language). diff --git a/core/modules/search/src/Tests/SearchRankingTest.php b/core/modules/search/src/Tests/SearchRankingTest.php index b434bc9..9d84241 100644 --- a/core/modules/search/src/Tests/SearchRankingTest.php +++ b/core/modules/search/src/Tests/SearchRankingTest.php @@ -119,6 +119,7 @@ public function testRankings() { $this->drupalGet('admin/config/search/pages/manage/node_search'); $this->assertTrue($this->xpath('//select[@id="edit-rankings-' . $node_rank . '"]//option[@value="10"]'), 'Select list to prioritize ' . $node_rank . ' for node ranks is visible and set to 10.'); + \Drupal::entityManager()->getStorage('search_page')->resetCache(array('node_search')); // Reload the plugin to get the up-to-date values. $this->nodeSearch = entity_load('search_page', 'node_search'); // Do the search and assert the results. diff --git a/core/modules/shortcut/src/Tests/ShortcutLinksTest.php b/core/modules/shortcut/src/Tests/ShortcutLinksTest.php index 85c7253..94a7615 100644 --- a/core/modules/shortcut/src/Tests/ShortcutLinksTest.php +++ b/core/modules/shortcut/src/Tests/ShortcutLinksTest.php @@ -57,6 +57,10 @@ public function testShortcutLinkAdd() { ); $this->drupalPostForm('admin/config/user-interface/shortcut/manage/' . $set->id() . '/add-link', $form_data, t('Save')); $this->assertResponse(200); + + // Reset cache. + \Drupal::entityManager()->getStorage('shortcut_set')->resetCache(); + $saved_set = ShortcutSet::load($set->id()); $routes = $this->getShortcutInformation($saved_set, 'route_name'); $this->assertTrue(in_array($test['route_name'], $routes), 'Shortcut created: ' . $test['path']); @@ -137,7 +141,11 @@ public function testShortcutLinkRename() { $shortcuts = $set->getShortcuts(); $shortcut = reset($shortcuts); - $this->drupalPostForm('admin/config/user-interface/shortcut/link/' . $shortcut->id(), array('title[0][value]' => $new_link_name, 'path' => $shortcut->path->value), t('Save')); + $this->drupalPostForm('admin/config/user-interface/shortcut/link/' . $shortcut->id(), array('title[0][value]' => $new_link_name, 'path' => $shortcut->path->value), t('Save')); + + // Reset cache. + \Drupal::entityManager()->getStorage('shortcut_set')->resetCache(); + $saved_set = ShortcutSet::load($set->id()); $titles = $this->getShortcutInformation($saved_set, 'title'); $this->assertTrue(in_array($new_link_name, $titles), 'Shortcut renamed: ' . $new_link_name); @@ -156,6 +164,9 @@ public function testShortcutLinkChangePath() { $shortcuts = $set->getShortcuts(); $shortcut = reset($shortcuts); $this->drupalPostForm('admin/config/user-interface/shortcut/link/' . $shortcut->id(), array('title[0][value]' => $shortcut->getTitle(), 'path' => $new_link_path), t('Save')); + + // Reset cache. + \Drupal::entityManager()->getStorage('shortcut_set')->resetCache(); $saved_set = ShortcutSet::load($set->id()); $routes = $this->getShortcutInformation($saved_set, 'route_name'); $this->assertTrue(in_array('system.admin_config', $routes), 'Shortcut path changed: ' . $new_link_path); @@ -184,6 +195,9 @@ public function testShortcutLinkDelete() { $shortcuts = $set->getShortcuts(); $shortcut = reset($shortcuts); $this->drupalPostForm('admin/config/user-interface/shortcut/link/' . $shortcut->id() . '/delete', array(), 'Delete'); + + // Reset cache. + \Drupal::entityManager()->getStorage('shortcut_set')->resetCache(); $saved_set = ShortcutSet::load($set->id()); $ids = $this->getShortcutInformation($saved_set, 'id'); $this->assertFalse(in_array($shortcut->id(), $ids), 'Successfully deleted a shortcut.'); diff --git a/core/modules/shortcut/src/Tests/ShortcutSetsTest.php b/core/modules/shortcut/src/Tests/ShortcutSetsTest.php index 6a6b4e1..ad0e63a 100644 --- a/core/modules/shortcut/src/Tests/ShortcutSetsTest.php +++ b/core/modules/shortcut/src/Tests/ShortcutSetsTest.php @@ -26,6 +26,10 @@ function testShortcutSetAdd() { 'id' => strtolower($this->randomMachineName()), ); $this->drupalPostForm(NULL, $edit, t('Save')); + + // Reset cache. + \Drupal::entityManager()->getStorage('shortcut_set')->resetCache(); + $new_set = $this->container->get('entity.manager')->getStorage('shortcut_set')->load($edit['id']); $this->assertIdentical($new_set->id(), $edit['id'], 'Successfully created a shortcut set.'); $this->drupalGet('user/' . $this->admin_user->id() . '/shortcuts'); @@ -93,6 +97,10 @@ function testShortcutSetRename() { $this->drupalGet('admin/config/user-interface/shortcut'); $this->clickLink(t('Edit shortcut set')); $this->drupalPostForm(NULL, array('label' => $new_label), t('Save')); + + // Reset cache. + \Drupal::entityManager()->getStorage('shortcut_set')->resetCache(); + $set = ShortcutSet::load($set->id()); $this->assertTrue($set->label() == $new_label, 'Shortcut set has been successfully renamed.'); } diff --git a/core/modules/text/src/Tests/TextFieldTest.php b/core/modules/text/src/Tests/TextFieldTest.php index 330d9f8..ffe85b3 100644 --- a/core/modules/text/src/Tests/TextFieldTest.php +++ b/core/modules/text/src/Tests/TextFieldTest.php @@ -77,6 +77,7 @@ function testTextFieldValidation() { */ function testTextfieldWidgets() { $this->_testTextfieldWidgets('text', 'text_textfield'); + \Drupal::entityManager()->getStorage('entity_view_display')->resetCache(); $this->_testTextfieldWidgets('text_long', 'text_textarea'); } @@ -143,6 +144,7 @@ function _testTextfieldWidgets($field_type, $widget_type) { */ function testTextfieldWidgetsFormatted() { $this->_testTextfieldWidgetsFormatted('text', 'text_textfield'); + \Drupal::entityManager()->getStorage('entity_view_display')->resetCache(); $this->_testTextfieldWidgetsFormatted('text_long', 'text_textarea'); } diff --git a/core/modules/user/src/Tests/UserRoleAdminTest.php b/core/modules/user/src/Tests/UserRoleAdminTest.php index e8e8815..36dd74b 100644 --- a/core/modules/user/src/Tests/UserRoleAdminTest.php +++ b/core/modules/user/src/Tests/UserRoleAdminTest.php @@ -57,6 +57,10 @@ function testRoleAdministration() { $edit = array('label' => $role_name); $this->drupalPostForm("admin/people/roles/manage/{$role->id()}", $edit, t('Save')); $this->assertRaw(t('Role %label has been updated.', array('%label' => $role_name))); + + // Reset cache. + \Drupal::entityManager()->getStorage('user_role')->resetCache(); + $new_role = entity_load('user_role', $role->id(), TRUE); $this->assertEqual($new_role->label(), $role_name, 'The role name has been successfully changed.'); diff --git a/core/modules/user/src/Tests/Views/AccessRoleUITest.php b/core/modules/user/src/Tests/Views/AccessRoleUITest.php index 70a797d..956e5ae 100644 --- a/core/modules/user/src/Tests/Views/AccessRoleUITest.php +++ b/core/modules/user/src/Tests/Views/AccessRoleUITest.php @@ -52,7 +52,9 @@ public function testAccessRoleUI() { $this->assertResponse(200); $this->drupalPostForm(NULL, array(), t('Save')); - $view = $entity_manager->getStorage('view')->load('test_access_role'); + $storage_controller = $entity_manager->getStorage('view'); + $storage_controller->resetCache(array('test_access_role')); + $view = $storage_controller->load('test_access_role'); $display = $view->getDisplay('default'); $this->assertEqual($display['display_options']['access']['options']['role'], array('custom_role' => 'custom_role')); diff --git a/core/modules/views/src/Tests/Handler/AreaViewTest.php b/core/modules/views/src/Tests/Handler/AreaViewTest.php index 16bd12e..75ec376 100644 --- a/core/modules/views/src/Tests/Handler/AreaViewTest.php +++ b/core/modules/views/src/Tests/Handler/AreaViewTest.php @@ -44,6 +44,8 @@ public function testViewArea() { $this->assertTrue(strpos($output, 'view-test-simple-argument') !== FALSE, 'The test view is correctly embedded.'); $view->destroy(); + \Drupal::entityManager()->getStorage('view')->resetCache(array('test_simple_argument')); + $view->setArguments(array(27)); $this->executeView($view); $output = $view->render(); diff --git a/core/modules/views/src/Tests/Plugin/StyleTest.php b/core/modules/views/src/Tests/Plugin/StyleTest.php index 074abb7..8159a7e 100644 --- a/core/modules/views/src/Tests/Plugin/StyleTest.php +++ b/core/modules/views/src/Tests/Plugin/StyleTest.php @@ -68,6 +68,9 @@ public function testStyle() { $output = drupal_render($output); $this->assertTrue(strpos($output, $random_text) !== FALSE, 'Make sure that the rendering of the row plugin appears in the output of the view.'); + // Reset cache. + \Drupal::entityManager()->getStorage('view')->resetCache(); + // Test without row plugin support. $view = Views::getView('test_view'); $view->setDisplay(); diff --git a/core/modules/views/src/Views.php b/core/modules/views/src/Views.php index 525177f..30c6d59 100644 --- a/core/modules/views/src/Views.php +++ b/core/modules/views/src/Views.php @@ -227,7 +227,7 @@ public static function getApplicableViews($type) { $result = array(); foreach (\Drupal::entityManager()->getStorage('view')->loadMultiple($entity_ids) as $view) { // Check each display to see if it meets the criteria and is enabled. - $executable = $view->getExecutable(); + $executable = static::executableFactory()->get($view); $executable->initDisplay(); foreach ($executable->displayHandlers as $id => $handler) { if (!empty($handler->definition[$type]) && $handler->isEnabled()) { diff --git a/core/modules/views_ui/src/Tests/CustomBooleanTest.php b/core/modules/views_ui/src/Tests/CustomBooleanTest.php index ebf989b..0f22221 100644 --- a/core/modules/views_ui/src/Tests/CustomBooleanTest.php +++ b/core/modules/views_ui/src/Tests/CustomBooleanTest.php @@ -96,6 +96,8 @@ public function testCustomOption() { // Save the view. $this->drupalPostForm('admin/structure/views/view/test_view', array(), 'Save'); + // Reset cache. + \Drupal::entityManager()->getStorage('view')->resetCache(); $view = Views::getView('test_view'); $output = $view->preview(); $output = drupal_render($output); diff --git a/core/modules/views_ui/src/Tests/DisplayAttachmentTest.php b/core/modules/views_ui/src/Tests/DisplayAttachmentTest.php index 68fa2b3..c520dd9 100644 --- a/core/modules/views_ui/src/Tests/DisplayAttachmentTest.php +++ b/core/modules/views_ui/src/Tests/DisplayAttachmentTest.php @@ -53,6 +53,8 @@ public function testAttachmentUI() { $this->assertEqual($result[0]->attributes()->title, t('Multiple displays')); $this->drupalPostForm(NULL, array(), t('Save')); + // Reset cache. + \Drupal::entityManager()->getStorage('view')->resetCache(); $view = Views::getView('test_attachment_ui'); $view->initDisplay(); $this->assertEqual(array_keys($view->displayHandlers->get('attachment_1')->getOption('displays')), array('default', 'page_1'), 'The attached displays got saved as expected'); diff --git a/core/modules/views_ui/src/Tests/DisplayExtenderUITest.php b/core/modules/views_ui/src/Tests/DisplayExtenderUITest.php index 8978539..3770f1c 100644 --- a/core/modules/views_ui/src/Tests/DisplayExtenderUITest.php +++ b/core/modules/views_ui/src/Tests/DisplayExtenderUITest.php @@ -40,6 +40,9 @@ public function testDisplayExtenderUI() { $this->drupalPostForm($display_option_url, array('test_extender_test_option' => $random_text), t('Apply')); $this->assertLink($random_text); $this->drupalPostForm(NULL, array(), t('Save')); + + // Reset cache. + \Drupal::entityManager()->getStorage('view')->resetCache(); $view = Views::getView($view->storage->id()); $view->initDisplay(); $this->assertEqual($view->display_handler->getOption('test_extender_test_option'), $random_text, 'Make sure that the display extender option got saved.'); diff --git a/core/modules/views_ui/src/Tests/HandlerTest.php b/core/modules/views_ui/src/Tests/HandlerTest.php index 034106d..c30db54 100644 --- a/core/modules/views_ui/src/Tests/HandlerTest.php +++ b/core/modules/views_ui/src/Tests/HandlerTest.php @@ -102,6 +102,10 @@ public function testUICRUD() { // Save the view and have a look whether the handler was added as expected. $this->drupalPostForm(NULL, array(), t('Save')); + + // Reset cache. + \Drupal::entityManager()->getStorage('view')->resetCache(); + $view = $this->container->get('entity.manager')->getStorage('view')->load('test_view_empty'); $display = $view->getDisplay('default'); $this->assertTrue(isset($display['display_options'][$type_info['plural']][$id]), 'Ensure the field was added to the view itself.'); @@ -111,6 +115,10 @@ public function testUICRUD() { $this->assertNoLinkByHref($edit_handler_url, 0, 'The handler edit link does not appears in the UI after removing.'); $this->drupalPostForm(NULL, array(), t('Save')); + + // Reset cache. + \Drupal::entityManager()->getStorage('view')->resetCache(); + $view = $this->container->get('entity.manager')->getStorage('view')->load('test_view_empty'); $display = $view->getDisplay('default'); $this->assertFalse(isset($display['display_options'][$type_info['plural']][$id]), 'Ensure the field was removed from the view itself.'); @@ -132,6 +140,7 @@ public function testUICRUD() { $this->drupalPostForm(NULL, array(), t('Apply')); $this->drupalPostForm(NULL, array(), t('Save')); + $this->container->get('entity.manager')->getStorage('view')->resetCache(); $view = $this->container->get('entity.manager')->getStorage('view')->load('test_view_empty'); $display = $view->getDisplay('default'); $this->assertTrue(isset($display['display_options'][$type_info['plural']][$id]), 'Ensure the field was added to the view itself.'); diff --git a/core/modules/views_ui/src/Tests/ViewEditTest.php b/core/modules/views_ui/src/Tests/ViewEditTest.php index 62036f1..bd7bf23 100644 --- a/core/modules/views_ui/src/Tests/ViewEditTest.php +++ b/core/modules/views_ui/src/Tests/ViewEditTest.php @@ -146,6 +146,7 @@ public function testPluginProviders() { // Save the plugin form, to change the plugin used. $this->drupalPostForm("admin/structure/views/nojs/display/test_view/default/$plugin_type", array($element_name => $plugin_options['value']), t('Apply')); $this->drupalPostForm('admin/structure/views/view/test_view', array(), t('Save')); + \Drupal::entityManager()->getStorage('view')->resetCache(array('test_view')); // Check the plugin provider. $view = Views::getView('test_view'); $displays = $view->storage->get('display');