function FileCopyTest::doTransform

Same name in other branches
  1. 9 core/modules/migrate/tests/src/Kernel/process/FileCopyTest.php \Drupal\Tests\migrate\Kernel\process\FileCopyTest::doTransform()
  2. 8.9.x core/modules/migrate/tests/src/Kernel/process/FileCopyTest.php \Drupal\Tests\migrate\Kernel\process\FileCopyTest::doTransform()
  3. 11.x core/modules/migrate/tests/src/Kernel/process/FileCopyTest.php \Drupal\Tests\migrate\Kernel\process\FileCopyTest::doTransform()

Do an import using the destination.

Parameters

string $source_path: Source path to copy from.

string $destination_path: The destination path to copy to.

array $configuration: Process plugin configuration settings.

Return value

string The URI of the copied file.

6 calls to FileCopyTest::doTransform()
FileCopyTest::testNonExistentSourceFile in core/modules/migrate/tests/src/Kernel/process/FileCopyTest.php
Tests that non-existent files throw an exception.
FileCopyTest::testNonWritableDestination in core/modules/migrate/tests/src/Kernel/process/FileCopyTest.php
Tests that non-writable destination throw an exception.
FileCopyTest::testRenameFile in core/modules/migrate/tests/src/Kernel/process/FileCopyTest.php
Tests the 'rename' overwrite mode.
FileCopyTest::testSuccessfulCopies in core/modules/migrate/tests/src/Kernel/process/FileCopyTest.php
Tests successful imports/copies.
FileCopyTest::testSuccessfulMoves in core/modules/migrate/tests/src/Kernel/process/FileCopyTest.php
Tests successful moves.

... See full list

File

core/modules/migrate/tests/src/Kernel/process/FileCopyTest.php, line 248

Class

FileCopyTest
Tests the file_copy process plugin.

Namespace

Drupal\Tests\migrate\Kernel\process

Code

protected function doTransform($source_path, $destination_path, $configuration = []) {
    // Prepare a mock HTTP client.
    $this->container
        ->set('http_client', $this->createMock(Client::class));
    $plugin = FileCopy::create($this->container, $configuration, 'file_copy', []);
    $executable = $this->prophesize(MigrateExecutableInterface::class)
        ->reveal();
    $row = new Row([], []);
    return $plugin->transform([
        $source_path,
        $destination_path,
    ], $executable, $row, 'foo');
}

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