Commit 59f478ff authored by Dries's avatar Dries

Issue #2031519 by damiankloip: Deleting a view does not empty it's object cache.

parent 5aced021
......@@ -348,6 +348,16 @@ public function postCreate(EntityStorageControllerInterface $storage_controller)
$this->mergeDefaultDisplaysOptions();
}
/**
* {@inheritdoc}
*/
public static function postDelete(EntityStorageControllerInterface $storage_controller, array $entities) {
$tempstore = \Drupal::service('user.tempstore')->get('views');
foreach ($entities as $entity) {
$tempstore->delete($entity->id());
}
}
/**
* {@inheritdoc}
*/
......
......@@ -67,6 +67,12 @@ public function testCacheData() {
// Test we can save the view.
$this->drupalPost('admin/structure/views/view/test_view/edit', array(), t('Save'));
$this->assertRaw(t('The view %view has been saved.', array('%view' => 'Test view')));
// Test that a deleted view has no tempstore data.
$this->drupalPost('admin/structure/views/nojs/display/test_view/default/title', array(), t('Apply'));
$this->drupalPost('admin/structure/views/view/test_view/delete', array(), t('Delete'));
// No view tempstore data should be returned for this view after deletion.
$this->assertEqual($temp_store->getMetadata('test_view'), NULL, 'View tempstore data has been removed after deletion.');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment