Update to Laravel 12

This commit is contained in:
Jonny Barnes 2025-04-01 21:08:17 +01:00
parent b30973d0fe
commit 736b0ea831
Signed by: jonny
SSH key fingerprint: SHA256:CTuSlns5U7qlD9jqHvtnVmfYV3Zwl2Z7WnJ4/dqOaL8
82 changed files with 683 additions and 720 deletions

View file

@ -7,11 +7,12 @@ namespace Tests\Unit\Jobs;
use App\Jobs\ProcessMedia;
use Illuminate\Support\Facades\Storage;
use Intervention\Image\ImageManager;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class ProcessMediaJobTest extends TestCase
{
/** @test */
#[Test]
public function nonMediaFilesAreNotSaved(): void
{
$manager = app()->make(ImageManager::class);
@ -22,7 +23,7 @@ class ProcessMediaJobTest extends TestCase
$this->assertFileDoesNotExist(storage_path('app/media/') . 'file.txt');
}
/** @test */
#[Test]
public function smallImagesAreNotResized(): void
{
$manager = app()->make(ImageManager::class);
@ -37,7 +38,7 @@ class ProcessMediaJobTest extends TestCase
Storage::disk('local')->delete('public/media');
}
/** @test */
#[Test]
public function largeImagesHaveSmallerImagesCreated(): void
{
$manager = app()->make(ImageManager::class);
@ -45,16 +46,17 @@ class ProcessMediaJobTest extends TestCase
$job = new ProcessMedia('test-image.jpg');
$job->handle($manager);
Storage::disk('local')->assertExists('public/media/test-image.jpg');
Storage::disk('local')->assertExists('public/media/test-image-small.jpg');
Storage::disk('local')->assertExists('public/media/test-image-medium.jpg');
// These need to look in public disk
Storage::disk('public')->assertExists('media/test-image.jpg');
Storage::disk('public')->assertExists('media/test-image-small.jpg');
Storage::disk('public')->assertExists('media/test-image-medium.jpg');
$this->assertFileDoesNotExist(storage_path('app/media/') . 'test-image.jpg');
// Tidy up files created by the job
Storage::disk('local')->delete('public/media/test-image.jpg');
Storage::disk('local')->delete('public/media/test-image-small.jpg');
Storage::disk('local')->delete('public/media/test-image-medium.jpg');
Storage::disk('public')->delete('media/test-image.jpg');
Storage::disk('public')->delete('media/test-image-small.jpg');
Storage::disk('public')->delete('media/test-image-medium.jpg');
$this->removeDirIfEmpty(storage_path('app/public/media'));
$this->removeDirIfEmpty(storage_path('app/media'));
}