function DirectoryTest::testDirectoryCreation
Same name in other branches
- 8.9.x core/tests/Drupal/KernelTests/Core/File/DirectoryTest.php \Drupal\KernelTests\Core\File\DirectoryTest::testDirectoryCreation()
- 10 core/tests/Drupal/KernelTests/Core/File/DirectoryTest.php \Drupal\KernelTests\Core\File\DirectoryTest::testDirectoryCreation()
- 11.x core/tests/Drupal/KernelTests/Core/File/DirectoryTest.php \Drupal\KernelTests\Core\File\DirectoryTest::testDirectoryCreation()
Tests directory creation.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ File/ DirectoryTest.php, line 191
Class
- DirectoryTest
- Tests operations dealing with directories.
Namespace
Drupal\KernelTests\Core\FileCode
public function testDirectoryCreation() {
/** @var \Drupal\Core\File\FileSystemInterface $file_system */
$file_system = $this->container
->get('file_system');
// mkdir() recursion should work with or without a trailing slash.
$dir = $this->siteDirectory . '/files';
$this->assertTrue($file_system->mkdir($dir . '/foo/bar', 0775, TRUE));
$this->assertTrue($file_system->mkdir($dir . '/foo/baz/', 0775, TRUE));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.