You are here

public function TestLibraryFilesStream::__construct in Libraries API 8.3

Constructs a stream wrapper for test library files.

Dependency injection is generally not possible to implement for stream wrappers, because stream wrappers are initialized before the container is booted, but this stream wrapper is only registered explicitly from tests so it is possible here.

Parameters

\Drupal\Core\Extension\ModuleHandlerInterface $module_handler: The module handler.

\Drupal\Core\StringTranslation\TranslationInterface $string_translation: The string translation handler.

string $directory: The directory within the Libraries API's tests directory that is to be searched for test library files.

File

tests/src/Kernel/ExternalLibrary/TestLibraryFilesStream.php, line 51

Class

TestLibraryFilesStream
Provides a stream wrapper for accessing test library files.

Namespace

Drupal\Tests\libraries\Kernel\ExternalLibrary

Code

public function __construct(ModuleHandlerInterface $module_handler, TranslationInterface $string_translation, $directory) {
  $this->moduleHandler = $module_handler;
  $this->directory = (string) $directory;
  $this
    ->setStringTranslation($string_translation);
}