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
28 lines
1.0 KiB
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use App\Image\ImageProcessor;
|
|
use App\Models\Collection;
|
|
use App\Models\File;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Foundation\Testing\WithFaker;
|
|
use Illuminate\Support\Facades\Storage;
|
|
use Tests\Feature\Traits\FileImageTrait;
|
|
use Tests\Feature\Traits\FileShowTrait;
|
|
use Tests\TestCase;
|
|
|
|
class FileShowTest extends TestCase
|
|
{
|
|
use FileShowTrait, FileImageTrait;
|
|
public function test_user_can_resize_image_with_width_and_height_fields_ok()
|
|
{
|
|
$file = $this->one(File::class, dependencyAttributes: ['withImage' => true]);
|
|
$collection = Collection::find($file->collection_id);
|
|
$w = rand(10, 2000);
|
|
$h = rand(10, 2000);
|
|
$canv = rand(0, 1);
|
|
$response = $this->loginAs()->getJson(route('api.files.show', ['collection_name' => $collection->name, 'uuid' => $file->uuid, 'extention' => $collection->ext, 'w' => $w, 'h' => $h, 'canv' => $canv]));
|
|
$response->assertOk()->assertHeader('content-type', $response->headers->get('content-type'));
|
|
}
|
|
}
|