You are here

public function ExtensionStreamTest::setUp in System stream wrapper 8

Overrides KernelTestBase::setUp

File

tests/src/Kernel/File/ExtensionStreamTest.php, line 36

Class

ExtensionStreamTest
Tests system stream wrapper functions.

Namespace

Drupal\Tests\system_stream_wrapper\Kernel\File

Code

public function setUp() : void {
  parent::setUp();

  // Find the base url to be used later in tests.
  $this->baseUrl = $this->container
    ->get('request_stack')
    ->getCurrentRequest()
    ->getUriForPath(base_path());

  /** @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface $stream_wrapper_manager */
  $stream_wrapper_manager = $this->container
    ->get('stream_wrapper_manager');

  // Get stream wrapper instances.
  foreach ([
    'module',
    'theme',
    'profile',
  ] as $scheme) {
    $this->streamWrappers[$scheme] = $stream_wrapper_manager
      ->getViaScheme($scheme);
  }

  /** @var \Drupal\Core\Extension\ThemeInstallerInterface $theme_installer */
  $theme_installer = $this->container
    ->get('theme_installer');

  // Install Bartik and Seven themes.
  $theme_installer
    ->install([
    'bartik',
    'seven',
  ]);
}