Penambahan Akses Laman Dosen dab perbaikan fix

This commit is contained in:
Ariyutta
2026-11-09 12:01:30 +07:00
parent 33bc1233f7
commit ef46b84da8
48 changed files with 3018 additions and 131 deletions
+27
View File
@@ -29,6 +29,33 @@ class LegacyRoleTest extends TestCase
];
}
/** @return array<string, array{int, list<int>, bool, list<Role>}> */
public static function allCases(): array
{
return [
'mahasiswa' => [LegacyRole::JENIS_MAHASISWA, [], false, [Role::Mahasiswa]],
'hanya administrator pusat' => [LegacyRole::JENIS_PEGAWAI, [1], false, [Role::Superuser]],
'superuser yang dosen' => [LegacyRole::JENIS_PEGAWAI, [1, 2], true, [Role::Superuser, Role::Dosen]],
'staf yang dosen' => [LegacyRole::JENIS_PEGAWAI, [7], true, [Role::Operator, Role::Dosen]],
'ka progdi dosen: dosen dulu, operator karena otoritas lain' => [LegacyRole::JENIS_PEGAWAI, [18], true, [Role::Dosen, Role::Operator]],
'staf dan otoritas lain tidak ganda' => [LegacyRole::JENIS_PEGAWAI, [10, 20], false, [Role::Operator]],
'admin dan staf' => [LegacyRole::JENIS_PEGAWAI, [22, 7], false, [Role::Admin, Role::Operator]],
'dosen saja' => [LegacyRole::JENIS_PEGAWAI, [], true, [Role::Dosen]],
'tanpa otoritas' => [LegacyRole::JENIS_PEGAWAI, [], false, []],
'jenis tak dikenal' => [9, [1], false, []],
];
}
/**
* @param list<int> $otoritas
* @param list<Role> $expected
*/
#[DataProvider('allCases')]
public function test_account_may_use_every_role_it_holds(int $jenis, array $otoritas, bool $isDosen, array $expected): void
{
$this->assertSame($expected, LegacyRole::all($jenis, $otoritas, $isDosen));
}
/** @param list<int> $otoritas */
#[DataProvider('cases')]
public function test_legacy_account_maps_to_role(int $jenis, array $otoritas, bool $isDosen, ?Role $expected): void