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.

28 lines
1.0 KiB

  1. <?php
  2. namespace Tests\Feature;
  3. use App\Image\ImageProcessor;
  4. use App\Models\Collection;
  5. use App\Models\File;
  6. use Illuminate\Foundation\Testing\RefreshDatabase;
  7. use Illuminate\Foundation\Testing\WithFaker;
  8. use Illuminate\Support\Facades\Storage;
  9. use Tests\Feature\Traits\FileImageTrait;
  10. use Tests\Feature\Traits\FileShowTrait;
  11. use Tests\TestCase;
  12. class FileShowTest extends TestCase
  13. {
  14. use FileShowTrait, FileImageTrait;
  15. public function test_user_can_resize_image_with_width_and_height_fields_ok()
  16. {
  17. $file = $this->one(File::class, dependencyAttributes: ['withImage' => true]);
  18. $collection = Collection::find($file->collection_id);
  19. $w = rand(10, 2000);
  20. $h = rand(10, 2000);
  21. $canv = rand(0, 1);
  22. $response = $this->loginAs()->getJson(route('api.files.show', ['collection_name' => $collection->name, 'uuid' => $file->uuid, 'extention' => $collection->ext, 'w' => $w, 'h' => $h, 'canv' => $canv]));
  23. $response->assertOk()->assertHeader('content-type', $response->headers->get('content-type'));
  24. }
  25. }