diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateDrupal6Test.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateDrupal6Test.php
index a644a99..33835a7 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateDrupal6Test.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateDrupal6Test.php
@@ -158,9 +158,6 @@ protected function setUp() {
     $config->set('default', 'bartik');
     $config->set('admin', 'seven');
     $config->save();
-
-    // We need a temp file for testing the MigrateFileTest.
-    file_put_contents('/tmp/some-temp-file.jpg', '');
   }
 
   /**
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateFileTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateFileTest.php
index 342c077..31d2ca9 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateFileTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateFileTest.php
@@ -31,7 +31,6 @@ class MigrateFileTest extends MigrateDrupal6TestBase {
   protected function setUp() {
     // Set the temp file of the site to the same as the D6 site, this allows us
     // to test files which start and finish in the same place.
-    $this->tempFilesDirectory = '/tmp';
     parent::setUp();
     $dumps = array(
       $this->getDumpDirectory() . '/Files.php',
@@ -45,7 +44,7 @@ protected function setUp() {
     $executable = new MigrateExecutable($migration, $this);
     $executable->import();
     $this->standalone = TRUE;
-    file_put_contents('/tmp/some-temp-file.jpg', '');
+    file_put_contents($this->tempFilesDirectory . '/some-temp-file.jpg', '');
   }
 
   /**
