protected function DownloadTest::doTransform in Drupal 8
Same name and namespace in other branches
- 9 core/modules/migrate/tests/src/Kernel/process/DownloadTest.php \Drupal\Tests\migrate\Kernel\process\DownloadTest::doTransform()
- 10 core/modules/migrate/tests/src/Kernel/process/DownloadTest.php \Drupal\Tests\migrate\Kernel\process\DownloadTest::doTransform()
Runs an input value through the download plugin.
Parameters
string $destination_uri: The destination URI to download to.
array $configuration: (optional) Configuration for the download plugin.
Return value
string The local URI of the downloaded file.
3 calls to DownloadTest::doTransform()
- DownloadTest::testNonDestructiveDownload in core/modules/ migrate/ tests/ src/ Kernel/ process/ DownloadTest.php 
- Tests a download that renames the downloaded file if there's a collision.
- DownloadTest::testOverwritingDownload in core/modules/ migrate/ tests/ src/ Kernel/ process/ DownloadTest.php 
- Tests a download that overwrites an existing local file.
- DownloadTest::testWriteProtectedDestination in core/modules/ migrate/ tests/ src/ Kernel/ process/ DownloadTest.php 
- Tests that an exception is thrown if the destination URI is not writable.
File
- core/modules/ migrate/ tests/ src/ Kernel/ process/ DownloadTest.php, line 101 
Class
- DownloadTest
- Tests the download process plugin.
Namespace
Drupal\Tests\migrate\Kernel\processCode
protected function doTransform($destination_uri, $configuration = []) {
  // Prepare a mock HTTP client.
  $this->container
    ->set('http_client', $this
    ->createMock(Client::class));
  // Instantiate the plugin statically so it can pull dependencies out of
  // the container.
  $plugin = Download::create($this->container, $configuration, 'download', []);
  // Execute the transformation.
  $executable = $this
    ->createMock(MigrateExecutableInterface::class);
  $row = new Row([], []);
  // Return the downloaded file's local URI.
  $value = [
    'http://drupal.org/favicon.ico',
    $destination_uri,
  ];
  return $plugin
    ->transform($value, $executable, $row, 'foobaz');
}