From 51780523b4954d4cecbe1deb50ffabbe2c8b4a30 Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Sun, 4 Jan 2026 10:22:32 +0000 Subject: [PATCH] Fix unit tests --- app/Services/NoteService.php | 2 +- tests/Feature/MicropubControllerTest.php | 7 ++++--- tests/Unit/Jobs/ProcessMediaJobTest.php | 1 - 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Services/NoteService.php b/app/Services/NoteService.php index 096f7f25..ff77ef7b 100644 --- a/app/Services/NoteService.php +++ b/app/Services/NoteService.php @@ -53,7 +53,7 @@ class NoteService foreach ($this->getMedia($data) as $index => $media) { $note->media()->attach($media['value']->id, [ - 'alt_text' => $media['alt_text'], + 'alt_text' => $media['alt'], 'order' => $index, ]); } diff --git a/tests/Feature/MicropubControllerTest.php b/tests/Feature/MicropubControllerTest.php index 3d28f399..8d10fc63 100644 --- a/tests/Feature/MicropubControllerTest.php +++ b/tests/Feature/MicropubControllerTest.php @@ -236,11 +236,11 @@ class MicropubControllerTest extends TestCase * Test a valid micropub requests using JSON syntax creates a new note. */ #[Test] - public function micropub_client_api_request_creates_new_note(): void + public function micropub_client_api_request_creates_new_note_with_photo(): void { Queue::fake(); Media::create([ - 'path' => 'test-photo.jpg', + 'path' => 'media/test-photo.jpg', 'type' => 'image', ]); SyndicationTarget::factory()->create([ @@ -265,12 +265,13 @@ class MicropubControllerTest extends TestCase 'https://mastodon.social/@jonnybarnes', 'https://bsky.app/profile/jonnybarnes.uk', ], - 'photo' => [config('filesystems.disks.s3.url') . '/test-photo.jpg'], + 'photo' => [config('filesystems.disks.public.url') . '/media/test-photo.jpg'], ], ], ['HTTP_Authorization' => 'Bearer ' . $this->getToken()] ); $response + ->dump() ->assertStatus(201) ->assertJson(['response' => 'created']); Queue::assertPushed(SendWebMentions::class); diff --git a/tests/Unit/Jobs/ProcessMediaJobTest.php b/tests/Unit/Jobs/ProcessMediaJobTest.php index a405fde8..29eb780c 100644 --- a/tests/Unit/Jobs/ProcessMediaJobTest.php +++ b/tests/Unit/Jobs/ProcessMediaJobTest.php @@ -43,7 +43,6 @@ class ProcessMediaJobTest extends TestCase { $manager = app()->make(ImageManager::class); Storage::disk('local')->put('media/test-image.jpg', file_get_contents(__DIR__.'/../../test-image.jpg')); - ray(Storage::disk('local')->get('media/test-image.jpg')); $job = new ProcessMedia('media/test-image.jpg'); $job->handle($manager);