공개 이슈 https://github.com/gnuboard/g7/issues/22 — 본문에 삽입한 이미지가 카드/갤러리 목록 썸네일과 공유 미리보기(og:image)에 반영되지 않던 공백을 코어+3모듈+2템플릿에서 해소. - 코어 7.0.9: HtmlImageExtractor(내부 이미지 한정, origin 정규화 SSoT 재사용) + seo.og_image_default 사이트 기본 공유 이미지 설정 + SeoMetaResolver 폴백 체인 - board 1.1.0 / ecommerce 1.2.0 / page 1.1.0: content_thumbnail_url 캐시 컬럼, saving 추출(html 모드 한정·첨부 우선·비밀글 게이트 유지), filter_content_thumbnail 훅, 기존 데이터 백필 업그레이드 스텝 - ecommerce 카테고리 og:image 생산자 신설, page og:description 死키 정정 - sirsoft-basic 1.1.2 og 바인딩 정정, admin_basic 1.0.7 SEO 탭 업로더(+ja 팩 2종) - 검수 중 발견한 text 모드 오캐시 결함은 실패 테스트 선행 후 수정
72 lines
2.3 KiB
PHP
72 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace Modules\Sirsoft\Page\Tests\Feature\User;
|
|
|
|
// FeatureTestCase를 수동으로 require (autoload 전에 로드 필요)
|
|
require_once __DIR__.'/../../FeatureTestCase.php';
|
|
|
|
use Modules\Sirsoft\Page\Models\Page;
|
|
use Modules\Sirsoft\Page\Tests\FeatureTestCase;
|
|
use PHPUnit\Framework\Attributes\Test;
|
|
|
|
/**
|
|
* 공개 페이지 응답의 content_thumbnail_url 방출 테스트 (공개 이슈 #22 동종)
|
|
*
|
|
* PublicPageResource 가 본문 첫 내부 이미지 캐시를 방출해 페이지 표시 레이아웃의
|
|
* og:image 바인딩(page.data.content_thumbnail_url)이 값을 받는지 API 경계에서
|
|
* 고정합니다.
|
|
*/
|
|
class PageContentThumbnailResourceTest extends FeatureTestCase
|
|
{
|
|
protected function tearDown(): void
|
|
{
|
|
Page::where('slug', 'like', 'thumb-emit-%')->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' => '<p>본문</p><img src="/storage/pages/og-image.jpg">'],
|
|
]);
|
|
|
|
$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' => '<p>이미지 없는 본문</p>'],
|
|
]);
|
|
|
|
$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'));
|
|
}
|
|
}
|