keyBy('slug'); $financialOperations = $navigation->get('financial-operations'); $this->assertNotNull($financialOperations); $this->assertSame( ['ledger', 'shop-flows'], collect($financialOperations['pages'])->pluck('slug')->slice(-2)->values()->all(), ); $this->assertSame('店铺收支明细', collect($financialOperations['pages'])->last()['title']); $this->assertFalse($navigation->has('financial-ledger')); } public function test_ledger_and_shop_flows_are_quick_links_under_operating_reports(): void { $this->loginAs(); $reports = collect(SidebarMenu::groups($this->user))->firstWhere('title', '经营报表'); $this->assertNotNull($reports); $this->assertSame([ 'section' => 'financial-operations', 'page' => 'ledger', 'title' => '财务台账', 'icon' => 'menu_book', ], $reports['items'][0]); $this->assertSame([ 'section' => 'financial-operations', 'page' => 'shop-flows', 'title' => '店铺收支明细', 'icon' => 'receipt_long', ], $reports['items'][1]); $this->assertSame([ 'section' => 'financial-operations', 'page' => 'service-company-reconciliation', 'title' => '服务公司对账', 'icon' => 'fact_check', ], $reports['items'][2]); } public function test_service_company_reconciliation_page_opens_from_operating_reports(): void { $this->loginAs(); $target = route('business.pages.show', [ 'section' => 'financial-operations', 'page' => 'service-company-reconciliation', ]); $this->get($target) ->assertOk() ->assertSeeText('财务经营报表') ->assertSeeText('服务公司对账') ->assertSeeText('服务公司总览') ->assertSee('prototype-tag-link is-active', false); $this->get(route('business.pages.show', [ 'section' => 'financial-operations', 'page' => 'independent-company-reconciliation', ]) . '?source=legacy') ->assertRedirect($target . '?source=legacy'); } public function test_ledger_page_and_legacy_link_open_under_financial_operations(): void { $this->loginAs(); $target = route('business.pages.show', [ 'section' => 'financial-operations', 'page' => 'ledger', ]); $response = $this->get($target . '?tab=flows') ->assertOk() ->assertSeeText('财务经营报表') ->assertSeeText('财务台账') ->assertSee('data-ledger-page', false) ->assertSee('data-ledger-tab="flows"', false) ->assertSee($target . '?tab=accounts', false); $this->assertSame(1, substr_count($response->getContent(), 'href="' . e($target) . '"')); $legacy = route('business.pages.show', [ 'section' => 'financial-ledger', 'page' => 'ledger', ]); $this->get($legacy . '?tab=flows')->assertRedirect($target . '?tab=flows'); $this->get($legacy . '/flows')->assertRedirect($target . '?tab=flows'); $this->get(route('business.financial-ledger.accounts.template'))->assertOk(); } public function test_account_basics_follow_daily_flows_under_fund_summary(): void { $this->loginAs(); $html = $this->get(route('business.pages.show', [ 'section' => 'financial-operations', 'page' => 'ledger', ]) . '?tab=flows') ->assertOk() ->getContent(); $this->assertSame(1, preg_match('/