Files
HeuJung 057e002ad1 feat(core,ecommerce,ckeditor5,board,admin_basic): 공개 자산 직접 URL(CDN) 서빙 옵트인
StorageInterface::url 의 public 하드코딩을 완화하고 core.storage.filter_url 훅을
신설해, 완전 공개 자산(상품·카테고리·리뷰·에디터 이미지)의 직접 URL 서빙을 옵트인으로
열었다. 미설정 시 기존 스트리밍 100% 보존.

디스크 결정은 확장 개별 설정 > 코어 전역 > 미설정 순이며, 서빙·삭제·이동은 행에 기록된
disk 를 따라 전환 전후 자산이 혼재해도 각자 실제 저장 위치를 향한다. 고아 disk(공급
플러그인 비활성화)는 스트리밍으로 폴백해 500 이 되지 않는다.

공개 이슈 (@lyg-kaban 건의) 대응.
2026-08-14 08:05:54 +09:00

47 lines
1.5 KiB
PHP

<?php
namespace Modules\Sirsoft\Board\Tests\Unit;
use Modules\Sirsoft\Board\Models\Attachment;
use Modules\Sirsoft\Board\Tests\ModuleTestCase;
use PHPUnit\Framework\Attributes\Test;
/**
* 게시판 첨부 미리보기 URL 조립 단일 지점(previewUrlForSlug) 회귀 테스트
*
* URL 중복 조립 정리(#100) 후에도 응답 문자열이 기존과 동일함을 고정합니다.
* board 는 직접 URL 배선 대상이 아니므로 문자열 회귀 0 이 계약입니다.
*/
class AttachmentPreviewUrlTest extends ModuleTestCase
{
/**
* @effects board_response_strings_unchanged
*/
#[Test]
public function preview_url_for_slug_builds_board_preview_url(): void
{
$attachment = new Attachment;
$attachment->hash = 'abc123def456';
$this->assertSame(
'/api/modules/sirsoft-board/boards/notice/attachment/abc123def456/preview',
$attachment->previewUrlForSlug('notice')
);
}
#[Test]
public function preview_url_accessor_delegates_to_single_assembly_point(): void
{
$attachment = new Attachment;
$attachment->hash = 'abc123def456';
$attachment->mime_type = 'image/png';
$attachment->board_id = 0;
// board 관계 미로딩 + 존재하지 않는 board_id → slug 는 빈 문자열로 조립 (기존 동작 보존)
$this->assertSame(
'/api/modules/sirsoft-board/boards//attachment/abc123def456/preview',
$attachment->preview_url
);
}
}