*/ public static function otherRoles(): array { return [ 'superuser' => [Role::Superuser], 'admin' => [Role::Admin], 'operator' => [Role::Operator], 'dosen' => [Role::Dosen], ]; } public function test_guest_is_redirected_to_login(): void { $this->get(route('mahasiswa.transkrip'))->assertRedirect(route('login')); } #[DataProvider('otherRoles')] public function test_other_roles_are_forbidden(Role $role): void { $this->actingAs($this->userWithRole($role))->get(route('mahasiswa.transkrip'))->assertForbidden(); } public function test_mahasiswa_sees_the_page(): void { $this->actingAs($this->userWithRole(Role::Mahasiswa)) ->get(route('mahasiswa.transkrip')) ->assertOk() ->assertSee('Transkrip nilai') ->assertSee('Unduh PDF'); } }