function PrepareUninstallTest::setUp

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/Module/PrepareUninstallTest.php \Drupal\Tests\system\Functional\Module\PrepareUninstallTest::setUp()
  2. 10 core/modules/system/tests/src/Functional/Module/PrepareUninstallTest.php \Drupal\Tests\system\Functional\Module\PrepareUninstallTest::setUp()
  3. 11.x core/modules/system/tests/src/Functional/Module/PrepareUninstallTest.php \Drupal\Tests\system\Functional\Module\PrepareUninstallTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/system/tests/src/Functional/Module/PrepareUninstallTest.php, line 46

Class

PrepareUninstallTest
Tests that modules which provide entity types can be uninstalled.

Namespace

Drupal\Tests\system\Functional\Module

Code

public function setUp() {
    parent::setUp();
    $admin_user = $this->drupalCreateUser([
        'administer modules',
    ]);
    $this->drupalLogin($admin_user);
    // Create 10 nodes.
    for ($i = 1; $i <= 5; $i++) {
        $this->nodes[] = $this->drupalCreateNode([
            'type' => 'page',
        ]);
        $this->nodes[] = $this->drupalCreateNode([
            'type' => 'article',
        ]);
    }
    // Create 3 top-level taxonomy terms, each with 11 children.
    $vocabulary = $this->createVocabulary();
    for ($i = 1; $i <= 3; $i++) {
        $term = $this->createTerm($vocabulary);
        $this->terms[] = $term;
        for ($j = 1; $j <= 11; $j++) {
            $this->terms[] = $this->createTerm($vocabulary, [
                'parent' => [
                    'target_id' => $term->id(),
                ],
            ]);
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.