function KernelTestBase::setInstallProfile

Same name and namespace in other branches
  1. 9 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.

6 calls to KernelTestBase::setInstallProfile()
FileSystemRequirementsTest::setUp in core/tests/Drupal/KernelTests/Core/File/FileSystemRequirementsTest.php
KernelTestBase::setSetting in core/tests/Drupal/KernelTests/KernelTestBase.php
Sets an in-memory Settings variable.
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.
ModuleHandlerTest::testUninstallProfileDependencyBC in core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php
Tests uninstalling a module that is a "dependency" of a profile.

... See full list

File

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

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.