user->attachPermission( Permission::where('name', 'read-admin-panel')->firstOrFail(), ); } public function test_shop_ledger_uses_store_report_current_subject_and_platform(): void { $openStore = [ 'id' => 901, 'platform' => '天猫', 'erp_store_name' => '天猫-报表测试店', 'company_name' => '历史主体', 'store_status' => '0', 'withdrawal_account' => '回款账户甲', ]; $closedStore = [ 'id' => 902, 'platform' => '京东', 'erp_store_name' => '京东-已关店', 'company_name' => '历史主体', 'store_status' => '6', 'withdrawal_account' => null, ]; $this->mock(BusinessInformationMirrorRepository::class) ->shouldReceive('allStores') ->once() ->andReturn([$openStore, $closedStore]); $this->mock(StoreReportPeriodBuilder::class) ->shouldReceive('currentCompanies') ->once() ->with([$openStore]) ->andReturn(['天猫-报表测试店' => '当前存续主体']); $this->loginAs()->get($this->pageUrl()) ->assertOk() ->assertSeeTextInOrder([ '天猫', '天猫-报表测试店', '当前存续主体', '在营', '回款账户甲', ]) ->assertDontSeeText('京东-已关店') ->assertDontSeeText('历史主体'); } private function pageUrl(): string { return route('business.pages.show', [ 'company_id' => $this->company->id, 'section' => 'financial-operations', 'page' => 'ledger', ]); } }