function FileTransferTest::_writeDirectory

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

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