diff --git a/core/includes/file.inc b/core/includes/file.inc
index 1166d4e..f919887 100644
--- a/core/includes/file.inc
+++ b/core/includes/file.inc
@@ -1026,14 +1026,14 @@ function file_delete_multiple(array $fids) {
  * @see file_unmanaged_delete_recursive()
  */
 function file_unmanaged_delete($path) {
+  if (is_file($path)) {
+    return drupal_unlink($path);
+  }
   $logger = \Drupal::logger('file');
   if (is_dir($path)) {
     $logger->error('%path is a directory and cannot be removed using file_unmanaged_delete().', array('%path' => $path));
     return FALSE;
   }
-  if (is_file($path)) {
-    return drupal_unlink($path);
-  }
   // Return TRUE for non-existent file, but log that nothing was actually
   // deleted, as the current state is the intended result.
   if (!file_exists($path)) {
diff --git a/core/modules/simpletest/src/InstallerTestBase.php b/core/modules/simpletest/src/InstallerTestBase.php
index ebd9873..dfdbbeb 100644
--- a/core/modules/simpletest/src/InstallerTestBase.php
+++ b/core/modules/simpletest/src/InstallerTestBase.php
@@ -84,11 +84,11 @@ protected function setUp() {
       'pass_raw' => $this->randomName(),
     ));
 
-    // If any $settings are defined for this test, copy and prepare an actual
-    // settings.php, so as to resemble a regular installation.
+    // Copy and prepare an actual settings.php, so as to resemble a regular
+    // installation. Do not use File API; a potential error must trigger a PHP
+    // warning.
+    copy(DRUPAL_ROOT . '/sites/default/default.settings.php', DRUPAL_ROOT . '/' . $this->siteDirectory . '/settings.php');
     if (!empty($this->settings)) {
-      // Not using File API; a potential error must trigger a PHP warning.
-      copy(DRUPAL_ROOT . '/sites/default/default.settings.php', DRUPAL_ROOT . '/' . $this->siteDirectory . '/settings.php');
       $this->writeSettings($this->settings);
     }
 
