function 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 drupal/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedDeleteRecursiveTest.php
Try deleting a directory with some files.
UnmanagedDeleteRecursiveTest::testEmptyDirectory in drupal/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedDeleteRecursiveTest.php
Try deleting an empty directory.
UnmanagedDeleteRecursiveTest::testSubDirectory in drupal/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedDeleteRecursiveTest.php
Try deleting subdirectories with some files.
UnmanagedDeleteTest::testDirectory in drupal/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedDeleteTest.php
Try deleting a directory.

File

drupal/core/modules/system/lib/Drupal/system/Tests/File/FileTestBase.php, line 152
Definition of 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
      ->randomName();
  }
  $this
    ->assertTrue(drupal_mkdir($path) && is_dir($path), 'Directory was created successfully.');
  return $path;
}