You are here

public function FileTransferTest::_writeDirectory in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/system/tests/src/Functional/FileTransfer/FileTransferTest.php \Drupal\Tests\system\Functional\FileTransfer\FileTransferTest::_writeDirectory()
1 call to FileTransferTest::_writeDirectory()
FileTransferTest::_buildFakeModule in core/modules/system/tests/src/Functional/FileTransfer/FileTransferTest.php

File

core/modules/system/tests/src/Functional/FileTransfer/FileTransferTest.php, line 61

Class

FileTransferTest
Tests that the jail is respected and that protocols using recursive file move operations work.

Namespace

Drupal\Tests\system\Functional\FileTransfer

Code

public function _writeDirectory($base, $files = []) {
  mkdir($base);
  foreach ($files as $key => $file) {
    if (is_array($file)) {
      $this
        ->_writeDirectory($base . DIRECTORY_SEPARATOR . $key, $file);
    }
    else {

      // just write the filename into the file
      file_put_contents($base . DIRECTORY_SEPARATOR . $file, $file);
    }
  }
}