Loading core/modules/system/tests/src/Functional/FileTransfer/FileTransferTest.php +4 −20 Original line number Diff line number Diff line Loading @@ -91,26 +91,10 @@ public function _writeDirectory($base, $files = []): void { */ public function testJail(): void { $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, sys_get_temp_dir()); } catch (FileTransferException) { $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, $this->root . '/' . PublicStream::basePath()); } catch (FileTransferException) { $got_it = FALSE; } $this->assertTrue($got_it, 'Was able to copy a directory inside of the jailed area'); $this->expectException(FileTransferException::class); $this->expectExceptionMessage('@directory is outside of the @jail'); $this->testConnection->copyDirectory($source, sys_get_temp_dir()); } } Loading
core/modules/system/tests/src/Functional/FileTransfer/FileTransferTest.php +4 −20 Original line number Diff line number Diff line Loading @@ -91,26 +91,10 @@ public function _writeDirectory($base, $files = []): void { */ public function testJail(): void { $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, sys_get_temp_dir()); } catch (FileTransferException) { $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, $this->root . '/' . PublicStream::basePath()); } catch (FileTransferException) { $got_it = FALSE; } $this->assertTrue($got_it, 'Was able to copy a directory inside of the jailed area'); $this->expectException(FileTransferException::class); $this->expectExceptionMessage('@directory is outside of the @jail'); $this->testConnection->copyDirectory($source, sys_get_temp_dir()); } }