StorageInterface::url 의 public 하드코딩을 완화하고 core.storage.filter_url 훅을 신설해, 완전 공개 자산(상품·카테고리·리뷰·에디터 이미지)의 직접 URL 서빙을 옵트인으로 열었다. 미설정 시 기존 스트리밍 100% 보존. 디스크 결정은 확장 개별 설정 > 코어 전역 > 미설정 순이며, 서빙·삭제·이동은 행에 기록된 disk 를 따라 전환 전후 자산이 혼재해도 각자 실제 저장 위치를 향한다. 고아 disk(공급 플러그인 비활성화)는 스트리밍으로 폴백해 500 이 되지 않는다. 공개 이슈 (@lyg-kaban 건의) 대응.
50 lines
1.6 KiB
PHP
50 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace Tests\Unit;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
use PHPUnit\Framework\Attributes\Test;
|
|
use Tests\TestCase;
|
|
|
|
/**
|
|
* TestCase 유휴 DB 연결 정리 테스트
|
|
*
|
|
* 트랜잭션 트레이트 없는 순수 TestCase 테스트의 DB 연결이 tearDown 에서 닫히는지
|
|
* 검증합니다. 이 정리가 회귀하면 프로세스 내 테스트 수만큼 연결이 누적되어
|
|
* DB 를 쓰는 테스트가 max_connections 를 넘는 시점부터 전부
|
|
* 1040 Too many connections 로 실패합니다.
|
|
*/
|
|
class TestCaseConnectionPurgeTest extends TestCase
|
|
{
|
|
#[Test]
|
|
public function idle_connection_is_purged(): void
|
|
{
|
|
DB::select('select 1');
|
|
$this->assertNotEmpty($this->app['db']->getConnections(), '쿼리 후 연결이 열려 있어야 합니다');
|
|
|
|
$this->purgeIdleDatabaseConnections();
|
|
|
|
$this->assertSame([], $this->app['db']->getConnections(), '유휴 연결은 모두 닫혀야 합니다');
|
|
}
|
|
|
|
#[Test]
|
|
public function transacting_connection_survives_purge(): void
|
|
{
|
|
DB::beginTransaction();
|
|
|
|
try {
|
|
$this->purgeIdleDatabaseConnections();
|
|
|
|
// 트랜잭션 진행 중 연결은 보존 — 트레이트의 롤백 콜백이 담당한다
|
|
$this->assertArrayHasKey(
|
|
DB::getDefaultConnection(),
|
|
$this->app['db']->getConnections(),
|
|
'트랜잭션 진행 중인 연결은 purge 대상이 아니어야 합니다',
|
|
);
|
|
$this->assertSame(1, DB::connection()->transactionLevel());
|
|
} finally {
|
|
DB::rollBack();
|
|
}
|
|
}
|
|
}
|