seed(RolePermissionSeeder::class); } #[Test] public function the_sidebar_links_to_the_documentation(): void { $this->actingAs($this->userWithRoles('super_admin')); $html = (string) $this->get('/admin')->assertSuccessful()->getContent(); $this->assertStringContainsString(route('docs.api'), $html); $this->assertMatchesRegularExpression( '/href="[^"]*docs\/api"[^>]*target="_blank"/', $html, 'The documentation should open in a new tab.', ); } #[Test] public function anybody_who_can_reach_the_panel_can_reach_the_docs(): void { // Reading the API reference is not a privilege: the page itself is // public, so hiding the link would only make it harder to find. $this->actingAs($this->userWithRoles('viewer')); $this->get('/admin') ->assertSuccessful() ->assertSee(route('docs.api'), escape: false); } /** * The panel is configured once per process, so a label resolved there * would freeze in whatever language happened to be active at boot. This is * the test that catches that, and it has to run in its own request to * mean anything. */ #[Test] public function the_label_follows_the_language_being_browsed(): void { $this->actingAs($this->userWithRoles('super_admin')); $this->get('/admin?lang=en') ->assertSuccessful() ->assertSee(__('docs.title', [], 'en')); } }