function KernelTestBase::setInstallProfile

Same name in other branches
  1. 8.9.x core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::setInstallProfile()
  2. 10 core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::setInstallProfile()
  3. 11.x core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::setInstallProfile()

Sets the install profile and rebuilds the container to update it.

Parameters

string $profile: The install profile to set.

4 calls to KernelTestBase::setInstallProfile()
FileSystemRequirementsTest::setUp in core/tests/Drupal/KernelTests/Core/File/FileSystemRequirementsTest.php
ModuleHandlerTest::testProfileAllDependencies in core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php
Tests that a profile can supply only real dependencies.
ModuleHandlerTest::testUninstallProfileDependency in core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php
Tests uninstalling a module installed by a profile.
SystemListingCrossProfileCompatibleTest::setUp in core/profiles/testing/modules/drupal_system_listing_compatible_test/tests/src/Kernel/SystemListingCrossProfileCompatibleTest.php

File

core/tests/Drupal/KernelTests/KernelTestBase.php, line 949

Class

KernelTestBase
Base class for functional integration tests.

Namespace

Drupal\KernelTests

Code

protected function setInstallProfile($profile) {
    $this->container
        ->get('config.factory')
        ->getEditable('core.extension')
        ->set('profile', $profile)
        ->save();
    // The installation profile is provided by a container parameter. Saving
    // the configuration doesn't automatically trigger invalidation
    $this->container
        ->get('kernel')
        ->rebuildContainer();
}

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