Fix unit tests
This commit is contained in:
parent
9e788e0fe8
commit
51780523b4
3 changed files with 5 additions and 5 deletions
|
|
@ -53,7 +53,7 @@ class NoteService
|
||||||
|
|
||||||
foreach ($this->getMedia($data) as $index => $media) {
|
foreach ($this->getMedia($data) as $index => $media) {
|
||||||
$note->media()->attach($media['value']->id, [
|
$note->media()->attach($media['value']->id, [
|
||||||
'alt_text' => $media['alt_text'],
|
'alt_text' => $media['alt'],
|
||||||
'order' => $index,
|
'order' => $index,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -236,11 +236,11 @@ class MicropubControllerTest extends TestCase
|
||||||
* Test a valid micropub requests using JSON syntax creates a new note.
|
* Test a valid micropub requests using JSON syntax creates a new note.
|
||||||
*/
|
*/
|
||||||
#[Test]
|
#[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();
|
Queue::fake();
|
||||||
Media::create([
|
Media::create([
|
||||||
'path' => 'test-photo.jpg',
|
'path' => 'media/test-photo.jpg',
|
||||||
'type' => 'image',
|
'type' => 'image',
|
||||||
]);
|
]);
|
||||||
SyndicationTarget::factory()->create([
|
SyndicationTarget::factory()->create([
|
||||||
|
|
@ -265,12 +265,13 @@ class MicropubControllerTest extends TestCase
|
||||||
'https://mastodon.social/@jonnybarnes',
|
'https://mastodon.social/@jonnybarnes',
|
||||||
'https://bsky.app/profile/jonnybarnes.uk',
|
'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()]
|
['HTTP_Authorization' => 'Bearer ' . $this->getToken()]
|
||||||
);
|
);
|
||||||
$response
|
$response
|
||||||
|
->dump()
|
||||||
->assertStatus(201)
|
->assertStatus(201)
|
||||||
->assertJson(['response' => 'created']);
|
->assertJson(['response' => 'created']);
|
||||||
Queue::assertPushed(SendWebMentions::class);
|
Queue::assertPushed(SendWebMentions::class);
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,6 @@ class ProcessMediaJobTest extends TestCase
|
||||||
{
|
{
|
||||||
$manager = app()->make(ImageManager::class);
|
$manager = app()->make(ImageManager::class);
|
||||||
Storage::disk('local')->put('media/test-image.jpg', file_get_contents(__DIR__.'/../../test-image.jpg'));
|
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 = new ProcessMedia('media/test-image.jpg');
|
||||||
$job->handle($manager);
|
$job->handle($manager);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue