X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/da1a66abd384911085d595e4ef06d36430a38a27..refs/pull/5721/head:/tests/Helpers/FileProvider.php diff --git a/tests/Helpers/FileProvider.php b/tests/Helpers/FileProvider.php index 9e44697c7..a455e0fb4 100644 --- a/tests/Helpers/FileProvider.php +++ b/tests/Helpers/FileProvider.php @@ -60,6 +60,14 @@ class FileProvider return file_get_contents($this->testFilePath('test-image.png')); } + /** + * Get raw data for a Jpeg image test file. + */ + public function jpegImageData(): string + { + return file_get_contents($this->testFilePath('test-image.jpg')); + } + /** * Get the expected relative path for an uploaded image of the given type and filename. */ @@ -133,12 +141,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 +167,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'))); + } }