1 filetransfer.test | FileTransferTest::testJail() |
File
- core/
modules/ simpletest/ tests/ filetransfer.test, line 63
Class
Code
function testJail() {
$source = $this->_buildFakeModule();
// This convoluted piece of code is here because our testing framework does
// not support expecting exceptions.
$got_it = FALSE;
try {
$this->testConnection->copyDirectory($source, '/tmp');
}
catch (FileTransferException $e) {
$got_it = TRUE;
}
$this->assertTrue($got_it, 'Was not able to copy a directory outside of the jailed area.');
$got_it = TRUE;
try {
$this->testConnection->copyDirectory($source, BACKDROP_ROOT . '/' . config_get('system.core', 'file_public_path'));
}
catch (FileTransferException $e) {
$got_it = FALSE;
}
$this->assertTrue($got_it, 'Was able to copy a directory inside of the jailed area');
}