Integrasi Login dan menu Dasar SIAKAD Operator dan Mahasiswa

This commit is contained in:
Ariyutta
2026-11-02 09:08:03 +07:00
parent b7a0c8705b
commit 43269095bf
68 changed files with 4287 additions and 216 deletions
+38
View File
@@ -0,0 +1,38 @@
<?php
namespace Tests\Unit;
use App\Support\GradeTone;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
class GradeToneTest extends TestCase
{
/** @return array<string, array{string|null, string}> */
public static function grades(): array
{
return [
'A' => ['A', 'success'],
'A-' => ['A-', 'success'],
'B+' => ['B+', 'info'],
'B' => ['B', 'info'],
'B-' => ['B-', 'info'],
'C+' => ['C+', 'gold'],
'C' => ['C', 'gold'],
'C-' => ['C-', 'gold'],
'D+' => ['D+', 'violet'],
'D' => ['D', 'violet'],
'E' => ['E', 'danger'],
'E+' => ['E+', 'danger'],
'huruf kecil berspasi' => [' b+ ', 'info'],
'kosong' => [null, 'neutral'],
'tak dikenal' => ['T', 'neutral'],
];
}
#[DataProvider('grades')]
public function test_grade_letter_maps_to_badge_tone(?string $grade, string $tone): void
{
$this->assertSame($tone, GradeTone::for($grade));
}
}
+38
View File
@@ -0,0 +1,38 @@
<?php
namespace Tests\Unit;
use App\Enums\Role;
use App\Support\Legacy\LegacyRole;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
class LegacyRoleTest extends TestCase
{
/** @return array<string, array{int, list<int>, bool, Role|null}> */
public static function cases(): array
{
return [
'mahasiswa' => [LegacyRole::JENIS_MAHASISWA, [], false, Role::Mahasiswa],
'administrator pusat' => [LegacyRole::JENIS_PEGAWAI, [1], false, Role::Superuser],
'superuser mengalahkan dosen' => [LegacyRole::JENIS_PEGAWAI, [1, 2], true, Role::Superuser],
'ka puskom' => [LegacyRole::JENIS_PEGAWAI, [22], false, Role::Admin],
'sisfo puskom' => [LegacyRole::JENIS_PEGAWAI, [40], true, Role::Admin],
'staf fakultas' => [LegacyRole::JENIS_PEGAWAI, [7], false, Role::Operator],
'staf nilai merangkap dekan' => [LegacyRole::JENIS_PEGAWAI, [10, 20], true, Role::Operator],
'otoritas dosen' => [LegacyRole::JENIS_PEGAWAI, [2], false, Role::Dosen],
'tercatat di t_dosen' => [LegacyRole::JENIS_PEGAWAI, [], true, Role::Dosen],
'ka progdi yang dosen' => [LegacyRole::JENIS_PEGAWAI, [18], true, Role::Dosen],
'pimpinan bukan dosen' => [LegacyRole::JENIS_PEGAWAI, [13], false, Role::Operator],
'pegawai tanpa otoritas' => [LegacyRole::JENIS_PEGAWAI, [], false, null],
'jenis tak dikenal' => [9, [1], false, null],
];
}
/** @param list<int> $otoritas */
#[DataProvider('cases')]
public function test_legacy_account_maps_to_role(int $jenis, array $otoritas, bool $isDosen, ?Role $expected): void
{
$this->assertSame($expected, LegacyRole::resolve($jenis, $otoritas, $isDosen));
}
}