user->attachPermission( Permission::where('name', 'read-admin-panel')->firstOrFail(), ); $connection = DB::connection('business_mirror'); foreach ([ [ 'company_name' => '保留直连公司', 'account_short' => '保留直连工行', 'account_type' => '公户', 'bank_name' => '中国工商银行上海分行', 'account_no' => '100200300400', 'single_limit' => '50000', 'daily_limit' => '100000', 'monthly_limit' => '500000', 'yearly_limit' => '5000000', 'company_plan' => '保留', 'account_should_keep' => '是', 'current_balance' => 100000, 'daily_available' => 80000, 'blocked_amount' => 20000, 'owner' => '张三', 'remark' => '保留账户备注', ], [ 'company_name' => '保留手动公司', 'account_short' => '保留手动支付宝', 'account_type' => '支付宝', 'account_no' => 'alipay@example.com', 'alipay_merchant_no' => '20880001', 'alipay_account_kind' => '企业支付宝', 'company_plan' => '保留', 'account_should_keep' => '是', 'current_balance' => 50000, 'daily_available' => 50000, 'blocked_amount' => 0, ], [ 'company_name' => '不保留银行公司', 'account_short' => '不保留华夏', 'account_type' => '公户', 'bank_name' => '华夏银行常州分行', 'account_no' => '131500000001', 'company_plan' => '不保留', 'account_should_keep' => '否', 'current_balance' => 30000, 'daily_available' => 30000, 'blocked_amount' => 0, ], [ 'company_name' => '不保留网商公司', 'account_short' => '不保留网商', 'account_type' => '网商银行', 'account_no' => 'wangshang@example.com', 'company_plan' => '不保留', 'account_should_keep' => '否', 'current_balance' => 12000, 'daily_available' => 10000, 'blocked_amount' => 2000, ], ] as $account) { $connection->table('fin_accounts')->insert($account); } $connection->table('fin_flow_summary_account_sources')->insert([ ['account_short' => '保留直连工行', 'data_source' => '银企直连', 'updated_by' => '测试'], ['account_short' => '保留手动支付宝', 'data_source' => '手动', 'updated_by' => '测试'], ['account_short' => '不保留华夏', 'data_source' => '手动', 'updated_by' => '测试'], ['account_short' => '不保留网商', 'data_source' => '手动', 'updated_by' => '测试'], ]); foreach ([ [ 'account_short' => '不保留华夏', 'owner_name' => '财务甲乙', 'started_at' => '2026-11-16', 'completed_at' => '2026-11-17', 'current_progress' => 'completed', 'updated_by' => '测试', ], [ 'account_short' => '不保留网商', 'owner_name' => '财务丙', 'started_at' => '2026-11-17', 'current_progress' => 'in_progress', 'updated_by' => '测试', ], ] as $task) { $connection->table('fin_account_keep_todos')->insert($task); } $connection->table('fin_daily_flows')->insert([ [ 'flow_date' => '2026-10-31', 'account_short' => '保留直连工行', 'opening_balance' => 80000, 'inflow' => 10000, 'outflow' => 0, 'closing_balance' => 90000, ], [ 'flow_date' => '2026-11-01', 'account_short' => '保留直连工行', 'opening_balance' => 90000, 'inflow' => 20000, 'outflow' => 10000, 'closing_balance' => 100000, ], ]); } protected function tearDown(): void { Carbon::setTestNow(); parent::tearDown(); } public function test_overview_separates_retained_and_unretained_accounts(): void { $html = $this->loginAs()->get($this->pageUrl())->assertOk()->getContent(); $this->assertStringContainsString('