user->attachPermission(
Permission::where('name', 'read-admin-panel')->firstOrFail()
);
$this->createInvoiceBasic('甲公司', '甲店铺组', 10000, 8500, '2026-11');
$this->createInvoiceBasic('乙公司', '乙店铺', 2000, 2500, '2026-11');
$this->createInvoiceBasic('丙公司', '丙店铺', 5000, 1000, '2026-11');
$this->createInvoiceBasic('零额度公司', '零额度店铺', 0, 0, '2026-11');
$this->createInvoiceBasic('历史公司', '历史店铺', 100, 100, '2026-10');
}
public function test_invoice_quota_is_listed_after_invoice_basic_information(): void
{
$pages = collect(config('business_navigation'))
->firstWhere('slug', 'invoice-management')['pages'];
$this->assertSame(
['automatic-invoicing', 'basic-information', 'invoice-quota', 'invoice-reports', 'store-backend-invoicing'],
array_column($pages, 'slug')
);
}
public function test_invoice_quota_defaults_to_latest_period_and_shows_usage_summary(): void
{
$this->loginAs()
->get($this->pageUrl())
->assertOk()
->assertSeeText('发票额度')
->assertSeeText('当前开票额度')
->assertSeeText('17,000.00')
->assertSeeText('12,000.00')
->assertSeeText('5,000.00')
->assertSeeText('甲公司')
->assertSeeText('8,500.00')
->assertSeeText('1,500.00')
->assertSeeText('85.0%')
->assertSeeText('乙公司')
->assertSeeText('-500.00')
->assertSeeText('超额')
->assertSeeText('需关注')
->assertSeeText('未设置额度')
->assertSeeText('超额 1 · 需关注 1')
->assertDontSeeText('历史公司')
->assertSee('