diff --git a/core/modules/file/src/Tests/DownloadTest.php b/core/modules/file/src/Tests/DownloadTest.php
index 239155cf40..8f85f09f96 100644
--- a/core/modules/file/src/Tests/DownloadTest.php
+++ b/core/modules/file/src/Tests/DownloadTest.php
@@ -118,16 +118,6 @@ public function testFileCreateUrl() {
       $this->checkUrl('private', '', $basename, $base_path . '/' . $script_path . 'system/files/' . $basename_encoded);
     }
     $this->assertEqual(file_create_url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=='), 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==', t('Generated URL matches expected URL.'));
-    // Test public files with a different host name from settings.
-    $test_base_url = 'http://www.example.com/cdn';
-    $this->settingsSet('file_public_base_url', $test_base_url);
-    $filepath = file_create_filename('test.txt', '');
-    $directory_uri = 'public://' . dirname($filepath);
-    file_prepare_directory($directory_uri, FILE_CREATE_DIRECTORY);
-    $file = $this->createFile($filepath, NULL, 'public');
-    $url = file_create_url($file->getFileUri());
-    $expected_url = $test_base_url . '/' . basename($filepath);
-    $this->assertEqual($url, $expected_url);
   }
 
   /**
diff --git a/core/modules/file/tests/src/Kernel/FileUrlTest.php b/core/modules/file/tests/src/Kernel/FileUrlTest.php
new file mode 100644
index 0000000000..9c11e61557
--- /dev/null
+++ b/core/modules/file/tests/src/Kernel/FileUrlTest.php
@@ -0,0 +1,46 @@
+<?php
+
+namespace Drupal\Tests\file\Kernel;
+
+use Drupal\Core\Site\Settings;
+
+/**
+ * Tests the file url.
+ *
+ * @group file
+ */
+class FileUrlTest extends FileManagedUnitTestBase {
+
+  /**
+   * Test file_create_url().
+   */
+  public function testFileCreateUrl() {
+    // Test public files with a different host name from settings.
+    $test_base_url = 'http://www.example.com/cdn';
+    $this->settingsSet('file_public_base_url', $test_base_url);
+    $filepath = file_create_filename('test.txt', '');
+    $directory_uri = 'public://' . dirname($filepath);
+    file_prepare_directory($directory_uri, FILE_CREATE_DIRECTORY);
+    $file = $this->createFile($filepath, NULL, 'public');
+    $url = file_create_url($file->getFileUri());
+    $expected_url = $test_base_url . '/' . basename($filepath);
+    $this->assertEqual($url, $expected_url);
+  }
+
+  /**
+   * Changes in memory settings.
+   *
+   * @param $name
+   *   The name of the setting to return.
+   * @param $value
+   *   The value of the setting.
+   *
+   * @see \Drupal\Core\Site\Settings::get()
+   */
+  protected function settingsSet($name, $value) {
+    $settings = Settings::getAll();
+    $settings[$name] = $value;
+    new Settings($settings);
+  }
+
+}
