From eb724ed348f86a95f62b76d471e7be5e2f827d03 Mon Sep 17 00:00:00 2001 From: HeuJung Date: Thu, 9 Jul 2026 19:05:25 +0900 Subject: [PATCH] =?UTF-8?q?test(ecommerce):=20=ED=86=B5=ED=99=94=20?= =?UTF-8?q?=EC=8A=A4=EB=83=85=EC=83=B7=20=EB=B6=80=EC=9E=AC=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=EA=B0=80=20=ED=8C=A9=ED=86=A0=EB=A6=AC=20?= =?UTF-8?q?=EA=B8=B0=EB=B3=B8=EA=B0=92=EC=97=90=20=EC=9D=98=EC=A1=B4?= =?UTF-8?q?=ED=95=98=EB=8D=98=20=EB=AC=B8=EC=A0=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit test_mc_fields_null_without_currency_snapshot 은 "OrderFactory 가 currency_snapshot 을 비워 둔다"는 전제로 작성됐으나, 이후 팩토리에 기본 스냅샷이 추가되면서 전제가 무너져 클린 트리에서도 실패하고 있었다. 비즈니스 로직 회귀가 아니라 stale test 다. 팩토리 기본값에 의존하지 않고 currency_snapshot 을 명시적으로 null 로 주입해 레거시 주문(다통화 도입 이전 행)의 취소 경로를 재현한다. 전제가 다시 조용히 무너지지 않도록 assert 로 고정했다. 전액취소 경로의 스냅샷 가드를 무력화하면 이 테스트가 실패하는 것을 확인했다. --- .../tests/Unit/Services/OrderAdjustmentServiceTest.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/_bundled/sirsoft-ecommerce/tests/Unit/Services/OrderAdjustmentServiceTest.php b/modules/_bundled/sirsoft-ecommerce/tests/Unit/Services/OrderAdjustmentServiceTest.php index 6dac1941..a68cf0fc 100644 --- a/modules/_bundled/sirsoft-ecommerce/tests/Unit/Services/OrderAdjustmentServiceTest.php +++ b/modules/_bundled/sirsoft-ecommerce/tests/Unit/Services/OrderAdjustmentServiceTest.php @@ -4775,6 +4775,9 @@ class OrderAdjustmentServiceTest extends ModuleTestCase /** * 다중통화 스냅샷이 없는 주문의 환불 시 mc_* 필드는 모두 null입니다. + * + * 레거시 주문(다통화 도입 이전에 생성되어 currency_snapshot 이 비어 있는 행)의 취소 경로를 + * 검증한다. OrderFactory 는 기본 스냅샷을 채우므로 여기서는 명시적으로 null 을 주입한다. */ public function test_mc_fields_null_without_currency_snapshot(): void { @@ -4790,6 +4793,8 @@ class OrderAdjustmentServiceTest extends ModuleTestCase // 통화 설정이 비어 있을 때만 우연히 falsy 가 되므로, 앞선 테스트가 통화 설정을 남기면 // 이 테스트가 간헐 실패한다. "스냅샷 없는 주문" 이라는 전제를 명시적으로 못박는다. $order = $this->createOrderFromCalculation($input, ['currency_snapshot' => null]); + $this->assertNull($order->currency_snapshot, '테스트 전제: 주문에 통화 스냅샷이 없다'); + $optA = $order->options->first(); $cancellation = $this->buildCancellation([ ['order_option_id' => $optA->id, 'cancel_quantity' => 1],