
| Current Path : /var/www/html/store/web/core/modules/system/tests/src/Functional/FileTransfer/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/store/web/core/modules/system/tests/src/Functional/FileTransfer/TestFileTransfer.php |
<?php
namespace Drupal\Tests\system\Functional\FileTransfer;
use Drupal\Core\FileTransfer\FileTransfer;
/**
* Mock FileTransfer object for test case.
*/
class TestFileTransfer extends FileTransfer {
/**
* {@inheritdoc}
*/
protected $host = '';
/**
* {@inheritdoc}
*/
protected $username = '';
/**
* {@inheritdoc}
*/
protected $password = '';
/**
* {@inheritdoc}
*/
protected $port = 0;
/**
* This is for testing the CopyRecursive logic.
*
* @var bool
*/
public $shouldIsDirectoryReturnTrue = FALSE;
public static function factory($jail, $settings) {
assert(is_array($settings));
return new TestFileTransfer($jail);
}
public function connect() {
$connection = new MockTestConnection();
$connection->connectionString = 'test://' . urlencode($this->username) . ':' . urlencode($this->password) . "@$this->host:$this->port/";
$this->connection = $connection;
}
public function copyFileJailed($source, $destination) {
$this->connection->run("copyFile $source $destination");
}
protected function removeDirectoryJailed($directory) {
$this->connection->run("rmdir $directory");
}
public function createDirectoryJailed($directory) {
$this->connection->run("mkdir $directory");
}
public function removeFileJailed($destination) {
$this->connection->run("rm $destination");
}
public function isDirectory($path) {
return $this->shouldIsDirectoryReturnTrue;
}
public function isFile($path) {
return FALSE;
}
public function chmodJailed($path, $mode, $recursive) {}
}