You are here

function FileTestBase::createDirectory in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/File/FileTestBase.php \Drupal\system\Tests\File\FileTestBase::createDirectory()

Create a directory and assert it exists.

Parameters

$path: Optional string with a directory path. If none is provided, a random name in the site's files directory will be used.

Return value

The path to the directory.

4 calls to FileTestBase::createDirectory()
UnmanagedDeleteRecursiveTest::testDirectory in core/modules/system/src/Tests/File/UnmanagedDeleteRecursiveTest.php
Try deleting a directory with some files.
UnmanagedDeleteRecursiveTest::testEmptyDirectory in core/modules/system/src/Tests/File/UnmanagedDeleteRecursiveTest.php
Try deleting an empty directory.
UnmanagedDeleteRecursiveTest::testSubDirectory in core/modules/system/src/Tests/File/UnmanagedDeleteRecursiveTest.php
Try deleting subdirectories with some files.
UnmanagedDeleteTest::testDirectory in core/modules/system/src/Tests/File/UnmanagedDeleteTest.php
Try deleting a directory.

File

core/modules/system/src/Tests/File/FileTestBase.php, line 129
Contains \Drupal\system\Tests\File\FileTestBase.

Class

FileTestBase
Base class for file tests that adds some additional file specific assertions and helper functions.

Namespace

Drupal\system\Tests\File

Code

function createDirectory($path = NULL) {

  // A directory to operate on.
  if (!isset($path)) {
    $path = file_default_scheme() . '://' . $this
      ->randomMachineName();
  }
  $this
    ->assertTrue(drupal_mkdir($path) && is_dir($path), 'Directory was created successfully.');
  return $path;
}