forceDelete(); parent::tearDown(); } /** * @scenario image_source=content_internal_only, locale_content=default_locale * * @effects public_resource_emits_thumbnail_key */ #[Test] public function public_response_emits_content_thumbnail_url(): void { config(['app.locale' => 'ko']); Page::factory()->create([ 'slug' => 'thumb-emit-filled', 'published' => true, 'published_at' => now(), 'content' => ['ko' => '
본문
'],
]);
$response = $this->getJson('/api/modules/sirsoft-page/pages/thumb-emit-filled');
$response->assertStatus(200);
$this->assertSame('/storage/pages/og-image.jpg', $response->json('data.content_thumbnail_url'));
}
/**
* @scenario image_source=none, locale_content=default_locale
*
* @effects public_resource_emits_thumbnail_key
*/
#[Test]
public function public_response_emits_null_when_no_image(): void
{
Page::factory()->create([
'slug' => 'thumb-emit-empty',
'published' => true,
'published_at' => now(),
'content' => ['ko' => '이미지 없는 본문
'], ]); $response = $this->getJson('/api/modules/sirsoft-page/pages/thumb-emit-empty'); $response->assertStatus(200); $this->assertArrayHasKey('content_thumbnail_url', $response->json('data')); $this->assertNull($response->json('data.content_thumbnail_url')); } }