protected function PrepareUninstallTest::setUp in Drupal 10
Same name and namespace in other branches
- 8 core/modules/system/tests/src/Functional/Module/PrepareUninstallTest.php \Drupal\Tests\system\Functional\Module\PrepareUninstallTest::setUp()
- 9 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 47
Class
- PrepareUninstallTest
- Tests that modules which provide entity types can be uninstalled.
Namespace
Drupal\Tests\system\Functional\ModuleCode
protected function setUp() : void {
parent::setUp();
$admin_user = $this
->drupalCreateUser([
'administer modules',
]);
$this
->drupalLogin($admin_user);
$this
->drupalCreateContentType([
'type' => 'article',
'name' => 'Article',
]);
node_access_rebuild();
node_access_test_add_field(NodeType::load('article'));
\Drupal::state()
->set('node_access_test.private', TRUE);
// Create 10 nodes.
for ($i = 1; $i <= 5; $i++) {
$this->nodes[] = $this
->drupalCreateNode([
'type' => 'page',
]);
// These 5 articles are inaccessible to the admin user doing the uninstalling.
$this->nodes[] = $this
->drupalCreateNode([
'type' => 'article',
'uid' => 0,
'private' => TRUE,
]);
}
// 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(),
],
]);
}
}
}