]> BookStack Code Mirror - bookstack/blobdiff - tests/Helpers/FileProvider.php
respective book and chapter structure added.
[bookstack] / tests / Helpers / FileProvider.php
index 9e44697c7a552738464286ed98379dbc11dfcd12..442e036ff245e4dda122b4d7a4bbbaf033293fd2 100644 (file)
@@ -133,12 +133,21 @@ class FileProvider
      */
     public function deleteAtRelativePath(string $path): void
     {
-        $fullPath = public_path($path);
+        $fullPath = $this->relativeToFullPath($path);
         if (file_exists($fullPath)) {
             unlink($fullPath);
         }
     }
 
+    /**
+     * Convert a relative path used by default in this provider to a full
+     * absolute local filesystem path.
+     */
+    public function relativeToFullPath(string $path): string
+    {
+        return public_path($path);
+    }
+
     /**
      * Delete all uploaded files.
      * To assist with cleanup.
@@ -150,4 +159,12 @@ class FileProvider
             $fileService->deleteFile($file);
         }
     }
+
+    /**
+     * Reset the application favicon image in the public path.
+     */
+    public function resetAppFavicon(): void
+    {
+        file_put_contents(public_path('favicon.ico'), file_get_contents(public_path('icon.ico')));
+    }
 }