.../node/lib/Drupal/node/Form/DeleteMultiple.php | 2 - .../node/lib/Drupal/node/Form/NodeDeleteForm.php | 2 - .../lib/Drupal/node/Tests/NodePageCacheTest.php | 97 -------------------- .../Tests/Entity/EntityCacheTagsTestBase.php | 4 +- 4 files changed, 2 insertions(+), 103 deletions(-) diff --git a/core/modules/node/lib/Drupal/node/Form/DeleteMultiple.php b/core/modules/node/lib/Drupal/node/Form/DeleteMultiple.php index 5f474d5..101f18c 100644 --- a/core/modules/node/lib/Drupal/node/Form/DeleteMultiple.php +++ b/core/modules/node/lib/Drupal/node/Form/DeleteMultiple.php @@ -7,7 +7,6 @@ namespace Drupal\node\Form; -use Drupal\Core\Cache\Cache; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Form\ConfirmFormBase; use Drupal\Component\Utility\String; @@ -123,7 +122,6 @@ public function submitForm(array &$form, array &$form_state) { $count = count($this->nodes); watchdog('content', 'Deleted @count posts.', array('@count' => $count)); drupal_set_message(format_plural($count, 'Deleted 1 post.', 'Deleted @count posts.')); - Cache::invalidateTags(array('content' => TRUE)); } $form_state['redirect_route']['route_name'] = 'node.content_overview'; } diff --git a/core/modules/node/lib/Drupal/node/Form/NodeDeleteForm.php b/core/modules/node/lib/Drupal/node/Form/NodeDeleteForm.php index 93148d4..1c1c336 100644 --- a/core/modules/node/lib/Drupal/node/Form/NodeDeleteForm.php +++ b/core/modules/node/lib/Drupal/node/Form/NodeDeleteForm.php @@ -7,7 +7,6 @@ namespace Drupal\node\Form; -use Drupal\Core\Cache\Cache; use Drupal\Core\Entity\ContentEntityConfirmFormBase; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Routing\UrlGeneratorInterface; @@ -91,7 +90,6 @@ public function submit(array $form, array &$form_state) { $node_type_storage = $this->entityManager->getStorageController('node_type'); $node_type = $node_type_storage->load($this->entity->bundle())->label(); drupal_set_message(t('@type %title has been deleted.', array('@type' => $node_type, '%title' => $this->entity->label()))); - Cache::invalidateTags(array('content' => TRUE)); $form_state['redirect_route']['route_name'] = ''; } diff --git a/core/modules/node/lib/Drupal/node/Tests/NodePageCacheTest.php b/core/modules/node/lib/Drupal/node/Tests/NodePageCacheTest.php deleted file mode 100644 index 49bc190..0000000 --- a/core/modules/node/lib/Drupal/node/Tests/NodePageCacheTest.php +++ /dev/null @@ -1,97 +0,0 @@ - 'Node page cache test', - 'description' => 'Test cache invalidation of node operations.', - 'group' => 'Node', - ); - } - - function setUp() { - parent::setUp(); - - $this->container->get('config.factory')->get('system.performance') - ->set('cache.page.use_internal', 1) - ->set('cache.page.max_age', 300) - ->save(); - - $this->adminUser = $this->drupalCreateUser(array( - 'bypass node access', - 'access content overview', - 'administer nodes', - )); - } - - /** - * Tests deleting nodes clears page cache. - */ - public function testNodeDelete() { - $author = $this->drupalCreateUser(); - $node_path = 'node/' . $this->drupalCreateNode(array('uid' => $author->id()))->id(); - - // Populate page cache. - $this->drupalGet($node_path); - - // Verify the presence of the correct cache tags. - $cid_parts = array(url($node_path, array('absolute' => TRUE)), 'html'); - $cid = sha1(implode(':', $cid_parts)); - $cache_entry = \Drupal::cache('page')->get($cid); - $this->assertIdentical($cache_entry->tags, array('content:1', 'user:' . $author->id(), 'filter_format:plain_text')); - - // Login and delete the node. - $this->drupalLogin($this->adminUser); - $this->drupalGet($node_path . '/delete'); - $this->drupalPostForm(NULL, array(), t('Delete')); - - // Logout and check the node is not available. - $this->drupalLogout(); - $this->drupalGet($node_path); - $this->assertResponse(404); - - // Create two new nodes. - $this->drupalCreateNode(); - $node_path = 'node/' . $this->drupalCreateNode()->id(); - - // Populate page cache. - $this->drupalGet($node_path); - - // Login and delete the nodes. - $this->drupalLogin($this->adminUser); - $this->drupalGet('admin/content'); - $edit = array( - 'action' => 'node_delete_action', - 'node_bulk_form[0]' => 1, - 'node_bulk_form[1]' => 1, - ); - $this->drupalPostForm(NULL, $edit, t('Apply')); - $this->drupalPostForm(NULL, array(), t('Delete')); - - // Logout and check the node is not available. - $this->drupalLogout(); - $this->drupalGet($node_path); - $this->assertResponse(404); - } - -} diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCacheTagsTestBase.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCacheTagsTestBase.php index 27427bb..8dc682b 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCacheTagsTestBase.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCacheTagsTestBase.php @@ -124,7 +124,7 @@ protected static function createReferenceTestEntities($referenced_entity) { // Add a field of the given type to the given entity type's "foo" bundle. $field_name = $referenced_entity->getEntityTypeId() . '_reference'; - entity_create('field_entity', array( + entity_create('field_config', array( 'name' => $field_name, 'entity_type' => $entity_type, 'type' => 'entity_reference', @@ -133,7 +133,7 @@ protected static function createReferenceTestEntities($referenced_entity) { 'target_type' => $referenced_entity->getEntityTypeId(), ), ))->save(); - entity_create('field_instance', array( + entity_create('field_instance_config', array( 'field_name' => $field_name, 'entity_type' => $entity_type, 'bundle' => $bundle,