function FileCopyTest::testNonExistent
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/File/FileCopyTest.php \Drupal\KernelTests\Core\File\FileCopyTest::testNonExistent()
- 8.9.x core/tests/Drupal/KernelTests/Core/File/FileCopyTest.php \Drupal\KernelTests\Core\File\FileCopyTest::testNonExistent()
- 11.x core/tests/Drupal/KernelTests/Core/File/FileCopyTest.php \Drupal\KernelTests\Core\File\FileCopyTest::testNonExistent()
Copy a non-existent file.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ File/ FileCopyTest.php, line 53
Class
- FileCopyTest
- Tests the unmanaged file copy function.
Namespace
Drupal\KernelTests\Core\FileCode
public function testNonExistent() : void {
// Copy non-existent file
$desired_filepath = $this->randomMachineName();
$this->assertFileDoesNotExist($desired_filepath);
$this->expectException(FileNotExistsException::class);
$new_filepath = \Drupal::service('file_system')->copy($desired_filepath, $this->randomMachineName());
$this->assertFalse($new_filepath, 'Copying a missing file fails.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.