function DownloadTest::testNonDestructiveDownload

Same name and namespace in other branches
  1. 9 core/modules/migrate/tests/src/Kernel/process/DownloadTest.php \Drupal\Tests\migrate\Kernel\process\DownloadTest::testNonDestructiveDownload()
  2. 8.9.x core/modules/migrate/tests/src/Kernel/process/DownloadTest.php \Drupal\Tests\migrate\Kernel\process\DownloadTest::testNonDestructiveDownload()
  3. 10 core/modules/migrate/tests/src/Kernel/process/DownloadTest.php \Drupal\Tests\migrate\Kernel\process\DownloadTest::testNonDestructiveDownload()

Tests a download that renames the downloaded file if there's a collision.

File

core/modules/migrate/tests/src/Kernel/process/DownloadTest.php, line 51

Class

DownloadTest
Tests the download process plugin.

Namespace

Drupal\Tests\migrate\Kernel\process

Code

public function testNonDestructiveDownload() : void {
    // Create a pre-existing file at the destination.
    $destination_uri = $this->createUri('another_existing_file.txt');
    // Test non-destructive download.
    $actual_destination = $this->doTransform($destination_uri, [
        'file_exists' => 'rename',
    ]);
    $this->assertSame('public://another_existing_file_0.txt', $actual_destination, 'Import returned a renamed destination');
    $this->assertFileExists($actual_destination);
}

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