function LegacyFileSystemTest::testMoveWithDeprecatedFileExists

Same name in other branches
  1. 11.x core/tests/Drupal/KernelTests/Core/File/LegacyFileSystemTest.php \Drupal\KernelTests\Core\File\LegacyFileSystemTest::testMoveWithDeprecatedFileExists()

@covers ::move

File

core/tests/Drupal/KernelTests/Core/File/LegacyFileSystemTest.php, line 45

Class

LegacyFileSystemTest
Tests the legacy file system functions.

Namespace

Drupal\KernelTests\Core\File

Code

public function testMoveWithDeprecatedFileExists() : void {
    $uri = 'public://test.txt';
    touch($uri);
    $this->expectDeprecation('Passing the $fileExists argument as an integer to Drupal\\Core\\File\\FileSystem::move() is deprecated in drupal:10.3.0 and is removed from drupal:12.0.0. Use \\Drupal\\Core\\File\\FileExists enum instead. See https://www.drupal.org/node/3426517');
    $newUri = $this->fileSystem
        ->move($uri, $uri, FileSystemInterface::EXISTS_RENAME);
    $this->assertFileExists($newUri);
}

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