function RecipeFinderTest::createTemporaryDirectory

Creates a unique directory within the OS temporary directory.

This isolates directory scanning from other tests, which can add and remove directories in the OS temporary directory at the same time. The new directory is removed when the test ends.

File

core/tests/Drupal/KernelTests/Core/Recipe/RecipeFinderTest.php, line 205

Class

RecipeFinderTest
Tests the recipe finder.

Namespace

Drupal\KernelTests\Core\Recipe

Code

private function createTemporaryDirectory() : string {
  $directory = FileSystem::getOsTemporaryDirectory() . '/recipe_finder_test' . $this->databasePrefix;
  $this->assertTrue(mkdir($directory));
  $this->temporaryDirectory = $directory;
  return $directory;
}

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