|
|
@@ -99,6 +99,26 @@ class AdminListAccountTest extends TestCase
|
|
|
$this->assertSame(['m2' => 'bob'], $this->accounts(BackflowService::paginate(['limit' => 10, 'account' => 'bo'])['data']));
|
|
|
}
|
|
|
|
|
|
+ public function test_backflow_list_shows_the_current_month_but_only_past_unpaid_months_can_be_granted(): void
|
|
|
+ {
|
|
|
+ \Carbon\Carbon::setTestNow(\Carbon\Carbon::parse('2026-11-05 15:00:00', 'Asia/Shanghai'));
|
|
|
+ try {
|
|
|
+ DB::table('backflow')->insert([
|
|
|
+ ['member_id' => 'm1', 'date' => '2026-11', 'status' => 0],
|
|
|
+ ['member_id' => 'm2', 'date' => '2026-10', 'status' => 0],
|
|
|
+ ['member_id' => 'm3', 'date' => '2026-10', 'status' => 1],
|
|
|
+ ['member_id' => 'm1', 'date' => '2026-12', 'status' => 0],
|
|
|
+ ]);
|
|
|
+ $rows = [];
|
|
|
+ foreach (json_decode(json_encode(BackflowService::paginate(['limit' => 10])['data']), true) as $row) {
|
|
|
+ $rows[$row['member_id'] . '|' . $row['date']] = $row['can_grant'];
|
|
|
+ }
|
|
|
+ $this->assertSame(['m1|2026-11' => false, 'm2|2026-10' => true, 'm3|2026-10' => false], $rows);
|
|
|
+ } finally {
|
|
|
+ \Carbon\Carbon::setTestNow();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public function test_recharge_list_shows_and_filters_account(): void
|
|
|
{
|
|
|
foreach (['m1', 'm2'] as $m) {
|