You are here

public function FileCopyTest::testRenameFile in Drupal 9

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

Class

FileCopyTest
Tests the file_copy process plugin.

Namespace

Drupal\Tests\migrate\Kernel\process

Code

public function testRenameFile() {
  $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.');
}