function FileCopyTest::testRenameFile

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

Tests the 'rename' overwrite mode.

File

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

Class

FileCopyTest
Tests the file_copy process plugin.

Namespace

Drupal\Tests\migrate\Kernel\process

Code

public function testRenameFile() : void {
    $source = $this->createUri(NULL, NULL, 'temporary');
    $destination = $this->createUri('foo.txt', NULL, 'public');
    $expected_destination = 'public://foo_0.txt';
    $actual_destination = $this->doTransform($source, $destination, [
        'file_exists' => 'rename',
    ]);
    $this->assertFileExists($expected_destination);
    $this->assertSame($actual_destination, $expected_destination, 'The importer returned the renamed filename.');
}

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