[Mahasiswa] Penambahan Cetak KRS, KHS, dan Transkrip
This commit is contained in:
@@ -39,6 +39,28 @@ class KrsTest extends TestCase
|
||||
$this->actingAs($user)->delete(route('mahasiswa.krs.hapus', 1))->assertForbidden();
|
||||
}
|
||||
|
||||
public function test_guest_is_redirected_to_login_for_the_pdf(): void
|
||||
{
|
||||
$this->get(route('mahasiswa.krs.cetak'))->assertRedirect(route('login'));
|
||||
}
|
||||
|
||||
#[DataProvider('otherRoles')]
|
||||
public function test_other_roles_are_forbidden_from_the_pdf(Role $role): void
|
||||
{
|
||||
$this->actingAs($this->userWithRole($role))->get(route('mahasiswa.krs.cetak'))->assertForbidden();
|
||||
}
|
||||
|
||||
public function test_demo_student_gets_the_pdf_of_the_sample_plan(): void
|
||||
{
|
||||
$response = $this->actingAs($this->userWithRole(Role::Mahasiswa, profile: ['nim' => 'D1041211999']))
|
||||
->get(route('mahasiswa.krs.cetak'))
|
||||
->assertOk();
|
||||
|
||||
$this->assertSame('application/pdf', $response->headers->get('Content-Type'));
|
||||
$this->assertStringContainsString('LIRS SEMESTER 9.pdf', $response->headers->get('Content-Disposition'));
|
||||
$this->assertStringStartsWith('%PDF', $response->getContent());
|
||||
}
|
||||
|
||||
public function test_demo_student_sees_the_prototype_and_cannot_use_real_actions(): void
|
||||
{
|
||||
$user = $this->userWithRole(Role::Mahasiswa);
|
||||
|
||||
Reference in New Issue
Block a user