function StreamWrapperManagerTest::testModuleInstallRegistration

Tests installing a module providing a stream wrapper using services.

File

core/tests/Drupal/KernelTests/Core/StreamWrapper/StreamWrapperManagerTest.php, line 71

Class

StreamWrapperManagerTest
Tests Drupal\Core\StreamWrapper\StreamWrapperManager.

Namespace

Drupal\KernelTests\Core\StreamWrapper

Code

public function testModuleInstallRegistration() : void {
  $this->container
    ->get('stream_wrapper_manager')
    ->register();
  $this->container
    ->get('module_installer')
    ->install([
    'stream_wrapper_service_test',
  ]);
  $manager = \Drupal::service('stream_wrapper_manager');
  $this->assertSame(ServiceDependencyStreamWrapper::class, $manager->getClass('test'));
  $wrapper = $manager->getViaScheme('test');
  $this->assertInstanceOf(ServiceDependencyStreamWrapper::class, $wrapper);
  $this->assertSame($manager, $wrapper->streamWrapperManager);
}

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