You are here

public function FileTestBase::register in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/File/FileTestBase.php \Drupal\KernelTests\Core\File\FileTestBase::register()

Registers test-specific services.

Extend this method in your test to register additional services. This method is called whenever the kernel is rebuilt.

Parameters

\Drupal\Core\DependencyInjection\ContainerBuilder $container: The service container to enhance.

Overrides KernelTestBase::register

See also

\Drupal\Tests\KernelTestBase::bootKernel()

File

core/tests/Drupal/KernelTests/Core/File/FileTestBase.php, line 51

Class

FileTestBase
Base class for file tests that adds some additional file specific assertions and helper functions.

Namespace

Drupal\KernelTests\Core\File

Code

public function register(ContainerBuilder $container) {
  parent::register($container);
  $container
    ->register('stream_wrapper.private', 'Drupal\\Core\\StreamWrapper\\PrivateStream')
    ->addTag('stream_wrapper', [
    'scheme' => 'private',
  ]);
  if (isset($this->scheme)) {
    $container
      ->register('stream_wrapper.' . $this->scheme, $this->classname)
      ->addTag('stream_wrapper', [
      'scheme' => $this->scheme,
    ]);
  }
}