You are here

public function ViewEditTest::testDeleteLink in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/views_ui/src/Tests/ViewEditTest.php \Drupal\views_ui\Tests\ViewEditTest::testDeleteLink()

Tests the delete link on a views UI.

File

core/modules/views_ui/src/Tests/ViewEditTest.php, line 30
Contains \Drupal\views_ui\Tests\ViewEditTest.

Class

ViewEditTest
Tests some general functionality of editing views, like deleting a view.

Namespace

Drupal\views_ui\Tests

Code

public function testDeleteLink() {
  $this
    ->drupalGet('admin/structure/views/view/test_view');
  $this
    ->assertLink(t('Delete view'), 0, 'Ensure that the view delete link appears');
  $view = $this->container
    ->get('entity.manager')
    ->getStorage('view')
    ->load('test_view');
  $this
    ->assertTrue($view instanceof View);
  $this
    ->clickLink(t('Delete view'));
  $this
    ->assertUrl('admin/structure/views/view/test_view/delete');
  $this
    ->drupalPostForm(NULL, array(), t('Delete'));
  $this
    ->assertRaw(t('The view %name has been deleted.', array(
    '%name' => $view
      ->label(),
  )));
  $this
    ->assertUrl('admin/structure/views');
  $view = $this->container
    ->get('entity.manager')
    ->getStorage('view')
    ->load('test_view');
  $this
    ->assertFalse($view instanceof View);
}