function DirectoryTest::testDirectoryCreation
Tests directory creation.
File
- 
              core/
tests/ Drupal/ KernelTests/ Core/ File/ DirectoryTest.php, line 193  
Class
- DirectoryTest
 - Tests operations dealing with directories.
 
Namespace
Drupal\KernelTests\Core\FileCode
public function testDirectoryCreation() : void {
  /** @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.