function KernelTestBase::setInstallProfile

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::setInstallProfile()
  2. 8.9.x core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::setInstallProfile()
  3. 10 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.

5 calls to KernelTestBase::setInstallProfile()
ConfigImporterTest::testInstallProfileMisMatch in core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php
Tests install profile validation during configuration import.
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 963

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.