assertIsInt($inventoryIndex); $this->assertIsInt($processDataIndex); $this->assertIsInt($financeIndex); $this->assertSame($inventoryIndex + 1, $processDataIndex); $this->assertSame($processDataIndex + 1, $financeIndex); $section = $navigation[$processDataIndex]; $this->assertSame('流程数据', $section['title']); $this->assertSame( [ ['slug' => 'oa-process', 'title' => 'OA流程'], ['slug' => 'invoice-data', 'title' => '发票数据'], ], array_map( static fn (array $page): array => [ 'slug' => $page['slug'], 'title' => $page['title'], ], $section['pages'], ), ); $finance = $navigation[$financeIndex]; $this->assertNotContains( 'process-details', array_column($finance['pages'] ?? [], 'slug'), ); } public function test_invoice_data_inherits_oa_process_permission_in_navigation(): void { $this->user->roles()->sync([Role::where('name', 'user')->firstOrFail()->id]); $subject = 'user_' . $this->user->id; setting()->set('system.sidebar_permissions', [ 'configured' => [$subject], 'subjects' => [$subject => ['process-data/oa-process']], ]); setting()->save(); $this->assertSame( ['process-data/oa-process'], SidebarPermissions::allowedKeys($this->user), ); $this->assertContains( 'process-data/invoice-data', SidebarPermissions::effectiveAllowedKeys($this->user), ); $processSection = collect(SidebarMenu::sections($this->user)) ->firstWhere('slug', 'process-data'); $this->assertSame( ['oa-process', 'invoice-data'], array_column($processSection['pages'] ?? [], 'slug'), ); } }