You are here

protected function InstallUninstallTest::preUninstallForum in Drupal 8

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

Deletes forum taxonomy terms, so Forum can be uninstalled.

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

File

core/modules/system/tests/src/Functional/Module/InstallUninstallTest.php, line 367

Class

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

Namespace

Drupal\Tests\system\Functional\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::entityTypeManager()
    ->getStorage('taxonomy_term');
  $terms = $storage
    ->loadMultiple($ids);
  $storage
    ->delete($terms);
}