function TestFileTransfer::factory

Same name and namespace in other branches
  1. 7.x modules/simpletest/tests/filetransfer.test \TestFileTransfer::factory()
  2. 8.9.x core/modules/system/tests/src/Functional/FileTransfer/TestFileTransfer.php \Drupal\Tests\system\Functional\FileTransfer\TestFileTransfer::factory()
  3. 10 core/modules/system/tests/src/Functional/FileTransfer/TestFileTransfer.php \Drupal\Tests\system\Functional\FileTransfer\TestFileTransfer::factory()
  4. 11.x core/modules/system/tests/src/Functional/FileTransfer/TestFileTransfer.php \Drupal\Tests\system\Functional\FileTransfer\TestFileTransfer::factory()

Defines a factory method for this class.

Classes that extend this class must override the factory() static method. They should return a new instance of the appropriate FileTransfer subclass.

Parameters

string $jail: The full path where all file operations performed by this object will be restricted to. This prevents the FileTransfer classes from being able to touch other parts of the filesystem.

array $settings: An array of connection settings for the FileTransfer subclass. If the getSettingsForm() method uses any nested settings, the same structure will be assumed here.

Return value

object New instance of the appropriate FileTransfer subclass.

Overrides FileTransfer::factory

1 call to TestFileTransfer::factory()
FileTransferTest::setUp in core/modules/system/tests/src/Functional/FileTransfer/FileTransferTest.php

File

core/modules/system/tests/src/Functional/FileTransfer/TestFileTransfer.php, line 43

Class

TestFileTransfer
Mock FileTransfer object for test case.

Namespace

Drupal\Tests\system\Functional\FileTransfer

Code

public static function factory($jail, $settings) {
    return new TestFileTransfer($jail, $settings['username'], $settings['password'], $settings['hostname'], $settings['port']);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.