test(governance): batchMarkActivated blocks mismatch/refund scopes

This commit is contained in:
萝卜
2026-03-17 05:20:46 +08:00
parent 2ac9c51ce4
commit b65cfd4fcb
2 changed files with 20 additions and 5 deletions

View File

@@ -106,22 +106,29 @@ class AdminPlatformOrderBatchMarkActivatedFilterFieldsTest extends TestCase
],
]);
// 批量生效:过滤条件=已支付+待处理 + 无回执 + 无退款 + 对账不一致,只应推进 A
// 治理口径升级:当筛选命中「无回执/对账不一致」等治理集合时,不允许直接批量仅标记为已生效。
// 这里用测试锁定:应直接被阻断,并给出 warning订单状态不应发生变化。
$this->post('/admin/platform-orders/batch-mark-activated', [
'scope' => 'filtered',
'payment_status' => 'paid',
'status' => 'pending',
'sync_status' => 'unsynced',
'receipt_status' => 'none',
'refund_status' => 'none',
'reconcile_mismatch' => '1',
'limit' => 50,
])->assertRedirect();
])
->assertRedirect()
->assertSessionHas('warning', function ($msg) {
$msg = (string) $msg;
return str_contains($msg, '无回执') || str_contains($msg, '回执');
});
$a->refresh();
$b->refresh();
$c->refresh();
$this->assertSame('activated', $a->status);
$this->assertSame('pending', $a->status);
$this->assertSame('pending', $b->status);
$this->assertSame('pending', $c->status);
}

View File

@@ -81,18 +81,26 @@ class AdminPlatformOrderBatchMarkActivatedRefundInconsistentFilterFieldsTest ext
'meta' => [],
]);
// 治理口径升级:当筛选命中「退款不一致」治理集合时,不允许直接批量仅标记为已生效。
// 这里用测试锁定:应直接被阻断,并给出 warning订单状态不应发生变化。
$this->post('/admin/platform-orders/batch-mark-activated', [
'scope' => 'filtered',
'payment_status' => 'paid',
'status' => 'pending',
'sync_status' => 'unsynced',
'refund_inconsistent' => '1',
'limit' => 50,
])->assertRedirect();
])
->assertRedirect()
->assertSessionHas('warning', function ($msg) {
$msg = (string) $msg;
return str_contains($msg, '退款不一致') || str_contains($msg, '对账不一致');
});
$a->refresh();
$b->refresh();
$this->assertSame('activated', $a->status);
$this->assertSame('pending', $a->status);
$this->assertSame('pending', $b->status);
}
}