diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Tests/ViewEditTest.php b/core/modules/views_ui/lib/Drupal/views_ui/Tests/ViewEditTest.php new file mode 100644 index 0000000..db74ae0 --- /dev/null +++ b/core/modules/views_ui/lib/Drupal/views_ui/Tests/ViewEditTest.php @@ -0,0 +1,48 @@ + 'General views edit test', + 'description' => 'Tests some general functionality of editing views, like deleting a view.', + 'group' => 'Views UI' + ); + } + + /** + * Tests the delete link on a views UI. + */ + public function testDeleteLink() { + $this->drupalGet('admin/structure/views/view/test_view'); + $this->assertLink(t('Delete view'), 0, 'Ensure that the view delete link appears'); + + $this->clickLink(t('Delete view')); + $this->assertUrl('admin/structure/views/view/test_view/delete'); + $this->drupalPost(NULL, array(), t('Delete')); + + $this->assertUrl('admin/structure/views'); + $view = $this->container->get('plugin.manager.entity')->getStorageController('view')->load('test_view'); + $this->assertFalse($view instanceof View); + } + +} diff --git a/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php b/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php index f926d8d..9aee61f 100644 --- a/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php +++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php @@ -679,6 +679,10 @@ public function renderDisplayTop(ViewUI $view) { 'href' => "admin/structure/views/nojs/reorder-displays/{$view->id()}/$display_id", 'attributes' => array('class' => array('views-ajax-link')), ), + 'delete' => array( + 'title' => $this->t('Delete view'), + 'href' => "admin/structure/views/view/{$view->id()}/delete", + ), ), );