Unverified Commit cd94d19d authored by Lauri Timmanee's avatar Lauri Timmanee
Browse files

Issue #2469545 by yogeshmpawar, willzyx, umarzaffer, idebr, ranjith_kumar_k_u,...

Issue #2469545 by yogeshmpawar, willzyx, umarzaffer, idebr, ranjith_kumar_k_u, smustgrave: Vocabulary listing missing delete operation for vocabularies
parent 5bfa2eee
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -109,6 +109,9 @@ public function getDefaultOperations(EntityInterface $entity) {
    if (isset($operations['edit'])) {
      $operations['edit']['title'] = t('Edit vocabulary');
    }
    if (isset($operations['delete'])) {
      $operations['delete']['title'] = $this->t('Delete vocabulary');
    }

    if ($entity->access('access taxonomy overview')) {
      $operations['list'] = [
@@ -127,8 +130,6 @@ public function getDefaultOperations(EntityInterface $entity) {
      ];
    }

    unset($operations['delete']);

    return $operations;
  }

+13 −0
Original line number Diff line number Diff line
@@ -88,6 +88,19 @@ public function testVocabularyInterface() {

    $site_name = $this->config('system.site')->get('name');
    $this->assertSession()->titleEquals("Don't Panic | $site_name");

    // Delete the vocabulary.
    $this->drupalGet('admin/structure/taxonomy');
    $this->assertSession()->linkByHrefExists(Url::fromRoute('entity.taxonomy_vocabulary.delete_form', ['taxonomy_vocabulary' => $edit['vid']])->toString());
    $this->clickLink(t('Delete vocabulary'));
    $this->assertSession()->responseContains(t('Are you sure you want to delete the vocabulary %name?', ['%name' => $edit['name']]));
    $this->assertSession()->pageTextContains(t('Deleting a vocabulary will delete all the terms in it. This action cannot be undone.'));

    // Confirm deletion.
    $this->submitForm([], 'Delete');
    $this->assertSession()->responseContains(t('Deleted vocabulary %name.', ['%name' => $edit['name']]));
    $this->container->get('entity_type.manager')->getStorage('taxonomy_vocabulary')->resetCache();
    $this->assertNull(Vocabulary::load($edit['vid']), 'Vocabulary not found.');
  }

  /**