function PackageManagerKernelTestBase::register

Overrides KernelTestBase::register

7 calls to PackageManagerKernelTestBase::register()
ChangeLoggerTest::register in core/modules/package_manager/tests/src/Kernel/ChangeLoggerTest.php
LockFileValidatorTest::register in core/modules/package_manager/tests/src/Kernel/LockFileValidatorTest.php
RsyncValidatorTest::register in core/modules/package_manager/tests/src/Kernel/RsyncValidatorTest.php
SiteConfigurationExcluderTest::register in core/modules/package_manager/tests/src/Kernel/PathExcluder/SiteConfigurationExcluderTest.php
SqliteDatabaseExcluderTest::register in core/modules/package_manager/tests/src/Kernel/PathExcluder/SqliteDatabaseExcluderTest.php

... See full list

7 methods override PackageManagerKernelTestBase::register()
ChangeLoggerTest::register in core/modules/package_manager/tests/src/Kernel/ChangeLoggerTest.php
LockFileValidatorTest::register in core/modules/package_manager/tests/src/Kernel/LockFileValidatorTest.php
RsyncValidatorTest::register in core/modules/package_manager/tests/src/Kernel/RsyncValidatorTest.php
SiteConfigurationExcluderTest::register in core/modules/package_manager/tests/src/Kernel/PathExcluder/SiteConfigurationExcluderTest.php
SqliteDatabaseExcluderTest::register in core/modules/package_manager/tests/src/Kernel/PathExcluder/SqliteDatabaseExcluderTest.php

... See full list

File

core/modules/package_manager/tests/src/Kernel/PackageManagerKernelTestBase.php, line 149

Class

PackageManagerKernelTestBase
Base class for kernel tests of Package Manager's functionality.

Namespace

Drupal\Tests\package_manager\Kernel

Code

public function register(ContainerBuilder $container) : void {
    parent::register($container);
    // If we previously set up a mock HTTP client in ::setReleaseMetadata(),
    // re-inject it into the container.
    if ($this->client) {
        $container->set('http_client', $this->client);
    }
    // When the test project is used, the disk space validator is replaced with
    // a mock. When staged changes are applied, the container is rebuilt, which
    // destroys the mocked service and can cause unexpected side effects. The
    // 'persist' tag prevents the mock from being destroyed during a container
    // rebuild.
    // @see ::createTestProject()
    $container->getDefinition(DiskSpaceValidator::class)
        ->addTag('persist');
    // Ensure that our failure logger will survive container rebuilds.
    $container->getDefinition('logger.channel.package_manager')
        ->addTag('persist');
    array_walk($this->disableValidators, $container->removeDefinition(...));
}

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