function FileCopyTest::doTransform

Same name and namespace in other branches
  1. 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.

File

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

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.