class TestFileTransfer in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/FileTransfer/TestFileTransfer.php \Drupal\system\Tests\FileTransfer\TestFileTransfer
Mock FileTransfer object for test case.
Hierarchy
- class \Drupal\Core\FileTransfer\FileTransfer
- class \Drupal\system\Tests\FileTransfer\TestFileTransfer
Expanded class hierarchy of TestFileTransfer
File
- core/
modules/ system/ src/ Tests/ FileTransfer/ TestFileTransfer.php, line 16 - Contains \Drupal\system\Tests\FileTransfer\TestFileTransfer.
Namespace
Drupal\system\Tests\FileTransferView source
class TestFileTransfer extends FileTransfer {
protected $host = NULL;
protected $username = NULL;
protected $password = NULL;
protected $port = NULL;
/**
* This is for testing the CopyRecursive logic.
*/
public $shouldIsDirectoryReturnTrue = FALSE;
function __construct($jail, $username, $password, $hostname = 'localhost', $port = 9999) {
parent::__construct($jail, $username, $password, $hostname, $port);
}
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}/";
}
function copyFileJailed($source, $destination) {
$this->connection
->run("copyFile {$source} {$destination}");
}
protected function removeDirectoryJailed($directory) {
$this->connection
->run("rmdir {$directory}");
}
function createDirectoryJailed($directory) {
$this->connection
->run("mkdir {$directory}");
}
function removeFileJailed($destination) {
if (!ftp_delete($this->connection, $item)) {
throw new FileTransferException('Unable to remove to file @file.', NULL, array(
'@file' => $item,
));
}
}
function isDirectory($path) {
return $this->shouldIsDirectoryReturnTrue;
}
function isFile($path) {
return FALSE;
}
function chmodJailed($path, $mode, $recursive) {
return;
}
}
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. | 1 |
FileTransfer:: |
final public | function | Copies a file. | |
FileTransfer:: |
final public | function | Creates a directory. | |
FileTransfer:: |
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. | 2 |
FileTransfer:: |
final public | function | Removes a directory. | |
FileTransfer:: |
final public | function | Removes a file. | |
FileTransfer:: |
function | Changes backslashes to slashes, also removes a trailing slash. | ||
FileTransfer:: |
function | Sets the chroot and changes the jail to match the correct path scheme. | ||
FileTransfer:: |
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:: |
function | |||
TestFileTransfer:: |
public | function |
Connects to the server. Overrides FileTransfer:: |
|
TestFileTransfer:: |
function |
Copies a file. Overrides FileTransfer:: |
||
TestFileTransfer:: |
function |
Creates a directory. Overrides FileTransfer:: |
||
TestFileTransfer:: |
static | function |
Defines a factory method for this class. Overrides FileTransfer:: |
|
TestFileTransfer:: |
function |
Checks if a particular path is a directory. Overrides FileTransfer:: |
||
TestFileTransfer:: |
function |
Checks if a particular path is a file (not a directory). Overrides FileTransfer:: |
||
TestFileTransfer:: |
protected | function |
Removes a directory. Overrides FileTransfer:: |
|
TestFileTransfer:: |
function |
Removes a file. Overrides FileTransfer:: |
||
TestFileTransfer:: |
function |
Constructs a Drupal\Core\FileTransfer\FileTransfer object. Overrides FileTransfer:: |