function PackageManagerKernelTestBase::register
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\KernelCode
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.