function FileTestCase::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 FileTestCase::createDirectory()
- FileUnmanagedDeleteRecursiveTest::testDirectory in modules/
simpletest/ tests/ file.test - Try deleting a directory with some files.
- FileUnmanagedDeleteRecursiveTest::testEmptyDirectory in modules/
simpletest/ tests/ file.test - Try deleting an empty directory.
- FileUnmanagedDeleteRecursiveTest::testSubDirectory in modules/
simpletest/ tests/ file.test - Try deleting subdirectories with some files.
- FileUnmanagedDeleteTest::testDirectory in modules/
simpletest/ tests/ file.test - Try deleting a directory.
File
-
modules/
simpletest/ tests/ file.test, line 176
Class
- FileTestCase
- Base class for file tests that adds some additional file specific assertions and helper functions.
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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.