diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php index d23341b..12fe528 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php @@ -242,6 +242,8 @@ protected function doSave($id, EntityInterface $entity) { // - The object needs to be renamed/copied in ConfigFactory and reloaded. // - All instances of the object need to be renamed. $config = $this->configFactory->rename($prefix . $id, $prefix . $entity->id()); + // Reset the cache for the old entity. + $this->resetCache(array($id)); } else { $config = $this->configFactory->get($prefix . $id); @@ -252,6 +254,8 @@ protected function doSave($id, EntityInterface $entity) { $config->set($key, $value); } $config->save(); + // Reset the cache for the entity. + $this->resetCache(array($entity->id())); return $is_new ? SAVED_NEW : SAVED_UPDATED; } diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php index 7960edc..1731ac4 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 getControllerClasses() { return parent::getControllerClasses() + array( 'storage' => 'Drupal\Core\Config\Entity\ConfigEntityStorage', diff --git a/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php b/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php index b21958b..e51e50c 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php @@ -652,8 +652,6 @@ protected function doDelete($entities) { $this->deleteFieldItems($entity); } - // Reset the cache as soon as the changes have been applied. - $this->resetCache($ids); } /** diff --git a/core/lib/Drupal/Core/Entity/EntityDatabaseStorage.php b/core/lib/Drupal/Core/Entity/EntityDatabaseStorage.php index 7a4316b..1f41ead 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/lib/Drupal/Core/Entity/EntityStorageBase.php b/core/lib/Drupal/Core/Entity/EntityStorageBase.php index f10eba9..35759f5 100644 --- a/core/lib/Drupal/Core/Entity/EntityStorageBase.php +++ b/core/lib/Drupal/Core/Entity/EntityStorageBase.php @@ -347,6 +347,9 @@ public function delete(array $entities) { $this->doDelete($entities); + // Reset the cache as soon as the changes have been applied. + $this->resetCache(array_keys($entities)); + $entity_class::postDelete($this, $entities); foreach ($entities as $entity) { $this->invokeHook('delete', $entity); diff --git a/core/modules/block/src/Tests/Views/DisplayBlockTest.php b/core/modules/block/src/Tests/Views/DisplayBlockTest.php index f54db91..948e604 100644 --- a/core/modules/block/src/Tests/Views/DisplayBlockTest.php +++ b/core/modules/block/src/Tests/Views/DisplayBlockTest.php @@ -219,6 +219,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 0d2d5b2..17c9315 100644 --- a/core/modules/ckeditor/src/Tests/CKEditorAdminTest.php +++ b/core/modules/ckeditor/src/Tests/CKEditorAdminTest.php @@ -143,6 +143,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.'); @@ -160,6 +161,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.'); @@ -186,6 +188,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 7813678..f2e02cd 100644 --- a/core/modules/contact/src/Tests/ContactSitewideTest.php +++ b/core/modules/contact/src/Tests/ContactSitewideTest.php @@ -414,6 +414,7 @@ function deleteCategories() { else { $this->drupalPostForm("admin/structure/contact/manage/$id/delete", array(), t('Delete')); $this->assertRaw(t('Category %label has been deleted.', array('%label' => $category->label()))); + \Drupal::entityManager()->getStorage('contact_category')->resetCache(); $this->assertFalse(entity_load('contact_category', $id), format_string('Category %category not found', array('%category' => $category->label()))); } } diff --git a/core/modules/field_ui/src/Tests/ManageDisplayTest.php b/core/modules/field_ui/src/Tests/ManageDisplayTest.php index c98d52d..266e13f 100644 --- a/core/modules/field_ui/src/Tests/ManageDisplayTest.php +++ b/core/modules/field_ui/src/Tests/ManageDisplayTest.php @@ -85,6 +85,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']; @@ -179,6 +180,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']; @@ -383,6 +385,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 f25fe79..8205094 100644 --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -183,6 +183,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 7aa30a8..32c20a3 100644 --- a/core/modules/filter/src/Tests/FilterAdminTest.php +++ b/core/modules/filter/src/Tests/FilterAdminTest.php @@ -229,6 +229,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 6217835..329c305 100644 --- a/core/modules/forum/src/Tests/ForumTest.php +++ b/core/modules/forum/src/Tests/ForumTest.php @@ -335,6 +335,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 bcad6fc..d8bf9bf 100644 --- a/core/modules/image/src/Tests/ImageAdminStylesTest.php +++ b/core/modules/image/src/Tests/ImageAdminStylesTest.php @@ -248,6 +248,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 54be792..93ba407 100644 --- a/core/modules/image/src/Tests/ImageFieldDefaultImagesTest.php +++ b/core/modules/image/src/Tests/ImageFieldDefaultImagesTest.php @@ -233,6 +233,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)); @@ -268,6 +271,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 e9ce5ef..d6d22e8 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 a1d2c14..cba75e3 100644 --- a/core/modules/options/src/Tests/OptionsFieldTest.php +++ b/core/modules/options/src/Tests/OptionsFieldTest.php @@ -60,6 +60,10 @@ function testUpdateAllowedValues() { // Removed options do not appear. $this->field->settings['allowed_values'] = array(2 => 'Two'); $this->field->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'); @@ -69,6 +73,10 @@ function testUpdateAllowedValues() { // Completely new options appear. $this->field->settings['allowed_values'] = array(10 => 'Update', 20 => 'Twenty'); $this->field->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 2648692..5a2e0ef 100644 --- a/core/modules/path/src/Tests/PathLanguageTest.php +++ b/core/modules/path/src/Tests/PathLanguageTest.php @@ -71,6 +71,8 @@ function setUp() { ); $this->drupalPostForm('admin/config/regional/content-language', $edit, t('Save')); + // Reset cache. + \Drupal::entityManager()->getStorage('field_config')->resetCache(); $field = FieldConfig::loadByName('node', 'body'); $this->assertTrue($field->isTranslatable(), 'Node body is translatable.'); } @@ -142,6 +144,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 48410d6..f6dd990 100644 --- a/core/modules/search/src/Tests/SearchRankingTest.php +++ b/core/modules/search/src/Tests/SearchRankingTest.php @@ -125,6 +125,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 cf2d732..1fc2f82 100644 --- a/core/modules/shortcut/src/Tests/ShortcutLinksTest.php +++ b/core/modules/shortcut/src/Tests/ShortcutLinksTest.php @@ -62,6 +62,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()); $paths = $this->getShortcutInformation($saved_set, 'path'); $this->assertTrue(in_array($this->container->get('path.alias_manager')->getPathByAlias($test['path']), $paths), 'Shortcut created: ' . $test['path']); @@ -123,7 +127,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); @@ -142,6 +150,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()); $paths = $this->getShortcutInformation($saved_set, 'path'); $this->assertTrue(in_array($new_link_path, $paths), 'Shortcut path changed: ' . $new_link_path); @@ -170,6 +181,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 c17316d..3c28ea6 100644 --- a/core/modules/shortcut/src/Tests/ShortcutSetsTest.php +++ b/core/modules/shortcut/src/Tests/ShortcutSetsTest.php @@ -32,6 +32,10 @@ function testShortcutSetAdd() { 'id' => strtolower($this->randomName()), ); $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'); @@ -99,6 +103,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 62a2ed4..d11d4ce 100644 --- a/core/modules/text/src/Tests/TextFieldTest.php +++ b/core/modules/text/src/Tests/TextFieldTest.php @@ -82,6 +82,7 @@ function testTextFieldValidation() { */ function testTextfieldWidgets() { $this->_testTextfieldWidgets('text', 'text_textfield'); + \Drupal::entityManager()->getStorage('entity_view_display')->resetCache(); $this->_testTextfieldWidgets('text_long', 'text_textarea'); } @@ -149,6 +150,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 0ddfa73..fd8d05c 100644 --- a/core/modules/user/src/Tests/UserRoleAdminTest.php +++ b/core/modules/user/src/Tests/UserRoleAdminTest.php @@ -64,6 +64,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', $old_name); $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 017c1a3..bb230c7 100644 --- a/core/modules/user/src/Tests/Views/AccessRoleUITest.php +++ b/core/modules/user/src/Tests/Views/AccessRoleUITest.php @@ -62,7 +62,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 a99a316..04a55dc 100644 --- a/core/modules/views/src/Tests/Handler/AreaViewTest.php +++ b/core/modules/views/src/Tests/Handler/AreaViewTest.php @@ -54,6 +54,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 b20afb6..fbd1a07 100644 --- a/core/modules/views/src/Tests/Plugin/StyleTest.php +++ b/core/modules/views/src/Tests/Plugin/StyleTest.php @@ -75,6 +75,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 daff41c..d067cba 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 1b40d9f..fe92bfd 100644 --- a/core/modules/views_ui/src/Tests/CustomBooleanTest.php +++ b/core/modules/views_ui/src/Tests/CustomBooleanTest.php @@ -103,6 +103,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 5d71210..59ec7d8 100644 --- a/core/modules/views_ui/src/Tests/DisplayAttachmentTest.php +++ b/core/modules/views_ui/src/Tests/DisplayAttachmentTest.php @@ -60,6 +60,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 388eb38..e8aea7f 100644 --- a/core/modules/views_ui/src/Tests/DisplayExtenderUITest.php +++ b/core/modules/views_ui/src/Tests/DisplayExtenderUITest.php @@ -46,6 +46,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 5a00b03..aa62940 100644 --- a/core/modules/views_ui/src/Tests/HandlerTest.php +++ b/core/modules/views_ui/src/Tests/HandlerTest.php @@ -109,6 +109,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.'); @@ -118,6 +122,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.'); @@ -139,6 +147,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 6652337..68b591c 100644 --- a/core/modules/views_ui/src/Tests/ViewEditTest.php +++ b/core/modules/views_ui/src/Tests/ViewEditTest.php @@ -152,6 +152,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');