class TestFileTransfer in Drupal 10
Same name and namespace in other branches
- 8 core/modules/system/tests/src/Functional/FileTransfer/TestFileTransfer.php \Drupal\Tests\system\Functional\FileTransfer\TestFileTransfer
- 9 core/modules/system/tests/src/Functional/FileTransfer/TestFileTransfer.php \Drupal\Tests\system\Functional\FileTransfer\TestFileTransfer
Mock FileTransfer object for test case.
Hierarchy
- class \Drupal\Core\FileTransfer\FileTransfer
- class \Drupal\Tests\system\Functional\FileTransfer\TestFileTransfer
Expanded class hierarchy of TestFileTransfer
1 string reference to 'TestFileTransfer'
- drupal7.php in core/
modules/ migrate_drupal/ tests/ fixtures/ drupal7.php - A database agnostic dump for testing purposes.
File
- core/
modules/ system/ tests/ src/ Functional/ FileTransfer/ TestFileTransfer.php, line 10
Namespace
Drupal\Tests\system\Functional\FileTransferView source
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 function __construct($jail, $username, $password, $hostname = 'localhost', $port = 9999) {
parent::__construct($jail, $username, $password, $hostname, $port);
}
public static function factory($jail, $settings) {
return new TestFileTransfer($jail, $settings['username'], $settings['password'], $settings['hostname'], $settings['port']);
}
public function connect() {
$this->connection = new MockTestConnection();
$this->connection->connectionString = 'test://' . urlencode($this->username) . ':' . urlencode($this->password) . "@{$this->host}:{$this->port}/";
}
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) {
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FileTransfer:: |
protected | property | The hostname for this file transfer. | |
FileTransfer:: |
final protected | function | Checks that the path is inside the jail and throws an exception if not. | |
FileTransfer:: |
final public | function | Changes the permissions of the specified $path (file or directory). | |
FileTransfer:: |
final public | function | Copies a directory. | |
FileTransfer:: |
protected | function | Copies a directory. | |
FileTransfer:: |
final public | function | Copies a file. | |
FileTransfer:: |
final public | function | Creates a directory. | |
FileTransfer:: |
public | function | Returns the chroot property for this connection. | |
FileTransfer:: |
final protected | function | Returns a modified path suitable for passing to the server. | |
FileTransfer:: |
public | function | Returns a form to collect connection settings credentials. | 1 |
FileTransfer:: |
final public | function | Removes a directory. | |
FileTransfer:: |
final public | function | Removes a file. | |
FileTransfer:: |
public | function | Changes backslashes to slashes, also removes a trailing slash. | |
FileTransfer:: |
public | function | Sets the chroot and changes the jail to match the correct path scheme. | |
FileTransfer:: |
public | function | Implements the magic __get() method. | |
TestFileTransfer:: |
protected | property | ||
TestFileTransfer:: |
protected | property |
The password for this file transfer. Overrides FileTransfer:: |
|
TestFileTransfer:: |
protected | property |
The port for this file transfer. Overrides FileTransfer:: |
|
TestFileTransfer:: |
public | property | This is for testing the CopyRecursive logic. | |
TestFileTransfer:: |
protected | property |
The username for this file transfer. Overrides FileTransfer:: |
|
TestFileTransfer:: |
public | function | ||
TestFileTransfer:: |
public | function |
Connects to the server. Overrides FileTransfer:: |
|
TestFileTransfer:: |
public | function |
Copies a file. Overrides FileTransfer:: |
|
TestFileTransfer:: |
public | function |
Creates a directory. Overrides FileTransfer:: |
|
TestFileTransfer:: |
public static | function |
Defines a factory method for this class. Overrides FileTransfer:: |
|
TestFileTransfer:: |
public | function |
Checks if a particular path is a directory. Overrides FileTransfer:: |
|
TestFileTransfer:: |
public | function |
Checks if a particular path is a file (not a directory). Overrides FileTransfer:: |
|
TestFileTransfer:: |
protected | function |
Removes a directory. Overrides FileTransfer:: |
|
TestFileTransfer:: |
public | function |
Removes a file. Overrides FileTransfer:: |
|
TestFileTransfer:: |
public | function |
Constructs a Drupal\Core\FileTransfer\FileTransfer object. Overrides FileTransfer:: |