function LegacyFileSystemTest::testGetDestinationFilenameWithDeprecatedFileExists

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

@covers ::getDestinationFilename

File

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

Class

LegacyFileSystemTest
Tests the legacy file system functions.

Namespace

Drupal\KernelTests\Core\File

Code

public function testGetDestinationFilenameWithDeprecatedFileExists() : void {
    $uri = 'public://test.txt';
    touch($uri);
    $newUri = $this->fileSystem
        ->getDestinationFilename($uri, FileSystemInterface::EXISTS_RENAME);
    $this->assertStringStartsWith('public://test_', $newUri);
    $this->assertNotEquals($newUri, $uri);
}

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