You are here

protected function InstallUninstallTest::preUninstallForum in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Module/InstallUninstallTest.php \Drupal\system\Tests\Module\InstallUninstallTest::preUninstallForum()

Deletes forum taxonomy terms, so Forum can be uninstalled.

1 call to InstallUninstallTest::preUninstallForum()
InstallUninstallTest::testInstallUninstall in core/modules/system/src/Tests/Module/InstallUninstallTest.php
Tests that a fixed set of modules can be installed and uninstalled.

File

core/modules/system/src/Tests/Module/InstallUninstallTest.php, line 316
Contains \Drupal\system\Tests\Module\InstallUninstallTest.

Class

InstallUninstallTest
Install/uninstall core module and confirm table creation/deletion.

Namespace

Drupal\system\Tests\Module

Code

protected function preUninstallForum() {

  // There only should be a 'General discussion' term in the 'forums'
  // vocabulary, but just delete any terms there in case the name changes.
  $query = \Drupal::entityQuery('taxonomy_term');
  $query
    ->condition('vid', 'forums');
  $ids = $query
    ->execute();
  $storage = \Drupal::entityManager()
    ->getStorage('taxonomy_term');
  $terms = $storage
    ->loadMultiple($ids);
  $storage
    ->delete($terms);
}