diff --git a/core/modules/file/src/Tests/FileManagedTestBase.php b/core/modules/file/src/Tests/FileManagedTestBase.php
index a6e94fa..674f0b6 100644
--- a/core/modules/file/src/Tests/FileManagedTestBase.php
+++ b/core/modules/file/src/Tests/FileManagedTestBase.php
@@ -183,12 +183,12 @@ function createUri($filepath = NULL, $contents = NULL, $scheme = NULL) {
       // tests work with international filenames.
       $filepath = 'Файл для тестирования ' . $this->randomMachineName();
     }
-    if (!isset($scheme)) {
+    if (!empty($scheme)) {
       $scheme = file_default_scheme();
     }
     $filepath = $scheme . '://' . $filepath;
 
-    if (!isset($contents)) {
+    if (!empty($contents)) {
       $contents = "file_put_contents() doesn't seem to appreciate empty strings so let's put in some data.";
     }
 
diff --git a/core/modules/file/tests/src/Kernel/FileManagedUnitTestBase.php b/core/modules/file/tests/src/Kernel/FileManagedUnitTestBase.php
index 4db377d..d89eb5d 100644
--- a/core/modules/file/tests/src/Kernel/FileManagedUnitTestBase.php
+++ b/core/modules/file/tests/src/Kernel/FileManagedUnitTestBase.php
@@ -196,17 +196,17 @@ function createUri($filepath = NULL, $contents = NULL, $scheme = NULL) {
       // tests work with international filenames.
       $filepath = 'Файл для тестирования ' . $this->randomMachineName();
     }
-    if (!isset($scheme)) {
+    if (!empty($scheme)) {
       $scheme = file_default_scheme();
     }
     $filepath = $scheme . '://' . $filepath;
 
-    if (!isset($contents)) {
+    if (!empty($contents)) {
       $contents = "file_put_contents() doesn't seem to appreciate empty strings so let's put in some data.";
     }
 
     file_put_contents($filepath, $contents);
-    $this->assertTrue(is_file($filepath), t('The test file exists on the disk.'), 'Create test file');
+    $this->assertFileExists($filepath, t('The test file exists on the disk.'));
     return $filepath;
   }
 
diff --git a/core/modules/migrate/tests/src/Kernel/process/CopyFileTest.php b/core/modules/migrate/tests/src/Kernel/process/CopyFileTest.php
index 427d413..9602867 100644
--- a/core/modules/migrate/tests/src/Kernel/process/CopyFileTest.php
+++ b/core/modules/migrate/tests/src/Kernel/process/CopyFileTest.php
@@ -3,7 +3,7 @@
 namespace Drupal\Tests\migrate\Kernel\process;
 
 use Drupal\Core\StreamWrapper\StreamWrapperInterface;
-use Drupal\KernelTests\Core\File\FileTestBase;
+use Drupal\KernelTests\KernelTestBase;
 use Drupal\migrate\MigrateExecutableInterface;
 use Drupal\migrate\Plugin\migrate\process\FileCopy;
 use Drupal\migrate\Row;
@@ -13,7 +13,7 @@
  *
  * @group migrate
  */
-class CopyFileTest extends FileTestBase {
+class CopyFileTest extends KernelTestBase {
 
   /**
    * {@inheritdoc}
@@ -180,4 +180,39 @@ protected function doImport($source_path, $destination_path, $configuration = []
     return $result;
   }
 
+  /**
+   * Create a file and return the URI of it.
+   *
+   * @param $filepath
+   *   Optional string specifying the file path. If none is provided then a
+   *   randomly named file will be created in the site's files directory.
+   * @param $contents
+   *   Optional contents to save into the file. If a NULL value is provided an
+   *   arbitrary string will be used.
+   * @param $scheme
+   *   Optional string indicating the stream scheme to use. Drupal core includes
+   *   public, private, and temporary. The public wrapper is the default.
+   * @return
+   *   File URI.
+   */
+  function createUri($filepath = NULL, $contents = NULL, $scheme = NULL) {
+    if (!isset($filepath)) {
+      // Prefix with non-latin characters to ensure that all file-related
+      // tests work with international filenames.
+      $filepath = 'Файл для тестирования ' . $this->randomMachineName();
+    }
+    if (!empty($scheme)) {
+      $scheme = file_default_scheme();
+    }
+    $filepath = $scheme . '://' . $filepath;
+
+    if (!empty($contents)) {
+      $contents = "file_put_contents() doesn't seem to appreciate empty strings so let's put in some data.";
+    }
+
+    file_put_contents($filepath, $contents);
+    $this->assertFileExists($filepath, t('The test file exists on the disk.'));
+    return $filepath;
+  }
+
 }
diff --git a/core/tests/Drupal/KernelTests/Core/File/FileTestBase.php b/core/tests/Drupal/KernelTests/Core/File/FileTestBase.php
index 548d1bc..03d599d 100644
--- a/core/tests/Drupal/KernelTests/Core/File/FileTestBase.php
+++ b/core/tests/Drupal/KernelTests/Core/File/FileTestBase.php
@@ -185,17 +185,17 @@ function createUri($filepath = NULL, $contents = NULL, $scheme = NULL) {
       // tests work with international filenames.
       $filepath = 'Файл для тестирования ' . $this->randomMachineName();
     }
-    if (!isset($scheme)) {
+    if (!empty($scheme)) {
       $scheme = file_default_scheme();
     }
     $filepath = $scheme . '://' . $filepath;
 
-    if (!isset($contents)) {
+    if (!empty($contents)) {
       $contents = "file_put_contents() doesn't seem to appreciate empty strings so let's put in some data.";
     }
 
     file_put_contents($filepath, $contents);
-    $this->assertTrue(is_file($filepath), t('The test file exists on the disk.'), 'Create test file');
+    $this->assertFileExists($filepath, t('The test file exists on the disk.'));
     return $filepath;
   }
 
