function FileTransferTest::testJail
File
-
core/
modules/ system/ tests/ src/ Functional/ FileTransfer/ FileTransferTest.php, line 81
Class
- FileTransferTest
- Tests recursive file copy operations with the file transfer jail.
Namespace
Drupal\Tests\system\Functional\FileTransferCode
public function testJail() {
$source = $this->_buildFakeModule();
// This convoluted piece of code is here because our testing framework does
// not support expecting exceptions.
$gotit = FALSE;
try {
$this->testConnection
->copyDirectory($source, sys_get_temp_dir());
} catch (FileTransferException $e) {
$gotit = TRUE;
}
$this->assertTrue($gotit, 'Was not able to copy a directory outside of the jailed area.');
$gotit = TRUE;
try {
$this->testConnection
->copyDirectory($source, $this->root . '/' . PublicStream::basePath());
} catch (FileTransferException $e) {
$gotit = FALSE;
}
$this->assertTrue($gotit, 'Was able to copy a directory inside of the jailed area');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.