diff --git a/core/modules/system/src/Tests/File/UnmanagedCopyTest.php b/core/modules/system/src/Tests/File/UnmanagedCopyTest.php index f525c1d..0bb23c6 100644 --- a/core/modules/system/src/Tests/File/UnmanagedCopyTest.php +++ b/core/modules/system/src/Tests/File/UnmanagedCopyTest.php @@ -52,9 +52,13 @@ function testNormal() { function testNonExistent() { // Copy non-existent file $desired_filepath = $this->randomMachineName(); - $this->assertFalse(file_exists($desired_filepath), "Randomly named file doesn't exists."); - $new_filepath = file_unmanaged_copy($desired_filepath, $this->randomMachineName()); - $this->assertFalse($new_filepath, 'Copying a missing file fails.'); + $this->assertFalse(file_exists($desired_filepath), "Randomly named file doesn't exist."); + try { + file_unmanaged_copy($desired_filepath, $this->randomMachineName()); + } + catch (\Exception $e) { + $this->assertTrue($e->getMessage(), 'Copying a missing file fails.'); + } } /** diff --git a/core/modules/system/src/Tests/File/UnmanagedMoveTest.php b/core/modules/system/src/Tests/File/UnmanagedMoveTest.php index ea39c54..9d33cda 100644 --- a/core/modules/system/src/Tests/File/UnmanagedMoveTest.php +++ b/core/modules/system/src/Tests/File/UnmanagedMoveTest.php @@ -52,8 +52,12 @@ function testNormal() { */ function testMissing() { // Move non-existent file. - $new_filepath = file_unmanaged_move($this->randomMachineName(), $this->randomMachineName()); - $this->assertFalse($new_filepath, 'Moving a missing file fails.'); + try { + file_unmanaged_move($this->randomMachineName(), $this->randomMachineName()); + } + catch (\Exception $e) { + $this->assertTrue($e->getMessage(), 'Moving a missing file fails.'); + } } /**