You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
642 B

  1. <?php
  2. namespace Tests\Feature\Traits;
  3. use App\Image\ImageProcessor;
  4. use Illuminate\Support\Facades\Storage;
  5. trait FileImageTrait
  6. {
  7. public function createImageForModel(\App\Models\Collection $collection, \App\Models\File $file): void
  8. {
  9. $imageProcessor = new ImageProcessor;
  10. $imageProcessor->createFakeImage(storage_path('stub') . '/image.png', Storage::disk($collection->disk)->path($file->server_path . $file->uuid . '.' . $collection->ext));
  11. }
  12. public function deleteFakeImageForModel(\App\Models\File $file): void
  13. {
  14. unlink($file->getPath());
  15. unlink($file->getModifiedPath());
  16. }
  17. }