]> BookStack Code Mirror - bookstack/blobdiff - tests/Exports/ZipTestHelper.php
ZIP Imports/Exports: Fixed some lint and test issues
[bookstack] / tests / Exports / ZipTestHelper.php
index 2196f361c178d7b68bc499402eb6c8d220f947f9..d830d8eb6bf9ea925f06f8e45fb1da084030ced2 100644 (file)
@@ -20,7 +20,14 @@ class ZipTestHelper
 
         $import = Import::factory()->create($importData);
         $zip = static::zipUploadFromData($zipData, $files);
-        rename($zip->getRealPath(), storage_path($import->path));
+        $targetPath = storage_path($import->path);
+        $targetDir = dirname($targetPath);
+
+        if (!file_exists($targetDir)) {
+            mkdir($targetDir);
+        }
+
+        rename($zip->getRealPath(), $targetPath);
 
         return $import;
     }