public function FileSystemTest::testCopyFailureIfSelfOverwrite in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/File/FileSystemTest.php \Drupal\KernelTests\Core\File\FileSystemTest::testCopyFailureIfSelfOverwrite()
- 9 core/tests/Drupal/KernelTests/Core/File/FileSystemTest.php \Drupal\KernelTests\Core\File\FileSystemTest::testCopyFailureIfSelfOverwrite()
@covers ::copy
File
- core/
tests/ Drupal/ KernelTests/ Core/ File/ FileSystemTest.php, line 76
Class
- FileSystemTest
- @coversDefaultClass \Drupal\Core\File\FileSystem @group File
Namespace
Drupal\KernelTests\Core\FileCode
public function testCopyFailureIfSelfOverwrite() {
$this
->expectException(FileException::class);
$this
->expectExceptionMessage("'public://test.txt' could not be copied because it would overwrite itself");
$uri = 'public://test.txt';
touch($uri);
$this->fileSystem
->copy($uri, $uri, FileSystemInterface::EXISTS_REPLACE);
}