You are here

trait FileSystemTrait in Acquia Content Hub 8.2

A trait for file system components.

@package Drupal\Tests\acquia_contenthub\Kernel\Core

Hierarchy

2 files declare their use of FileSystemTrait
FileImportExportTest.php in tests/src/Kernel/FileImportExportTest.php
MediaImportExportTest.php in tests/src/Kernel/MediaImportExportTest.php

File

tests/src/Kernel/Core/FileSystemTrait.php, line 10

Namespace

Drupal\Tests\acquia_contenthub\Kernel\Core
View source
trait FileSystemTrait {

  /**
   * File system component.
   *
   * @var \Drupal\Core\File\FileSystem
   */
  protected $fileSystem;

  /**
   * Adjust file system for test.
   */
  protected function fileSystemSetUp() {
    $this
      ->installEntitySchema('file');
    $this
      ->installSchema('file', [
      'file_usage',
    ]);
    $this->fileSystem = \Drupal::service('file_system');
    if (version_compare(\Drupal::VERSION, '8.8.0', '<')) {
      $this->fileSystem
        ->mkdir('public://2018-12');
    }
    $this->fileSystem
      ->mkdir('public://2020-03');
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FileSystemTrait::$fileSystem protected property File system component.
FileSystemTrait::fileSystemSetUp protected function Adjust file system for test.