function FileTransferTest::_writeDirectory

Same name in other branches
  1. 8.9.x core/modules/system/tests/src/Functional/FileTransfer/FileTransferTest.php \Drupal\Tests\system\Functional\FileTransfer\FileTransferTest::_writeDirectory()
  2. 10 core/modules/system/tests/src/Functional/FileTransfer/FileTransferTest.php \Drupal\Tests\system\Functional\FileTransfer\FileTransferTest::_writeDirectory()
  3. 11.x 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 68

Class

FileTransferTest
Tests recursive file copy operations with the file transfer jail.

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);
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.