420 lines
23 KiB
PHP
420 lines
23 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature\Operator\Reports;
|
|
|
|
use App\Support\Legacy\PortalException;
|
|
use App\Support\Legacy\Reports\ReportContext;
|
|
use App\Support\Legacy\Reports\ReportResult;
|
|
use App\Support\Legacy\Reports\TugasAkhirReports;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\Schema;
|
|
use Tests\Concerns\FakesLegacyDatabase;
|
|
use Tests\TestCase;
|
|
|
|
/**
|
|
* Laporan tugas akhir dan kelulusan dari DB lama (tiruan). Data uji (id 7xxx): prodi 71 (dalam cakupan) dan 72 (luar);
|
|
* mahasiswa 7201 (lulus, angkatan 2019), 7202 (aktif, 2020), 7203 (keluar, 2020, tanpa dosen), 7204 (prodi 72),
|
|
* 7205 (lulus, 2019, tanggal mulai rusak, tanpa rekap evaluasi).
|
|
*/
|
|
class TugasAkhirReportsTest extends TestCase
|
|
{
|
|
use FakesLegacyDatabase;
|
|
use RefreshDatabase;
|
|
|
|
private const array IMPLEMENTED = [
|
|
'repp_skripsi', 'repp_mhsskripsi', 'repp_totalmhsskripsi', 'repp_bimbinganta', 'repp_nilaiujiskripsi',
|
|
'repp_beritaacarata', 'repp_skpembimbingta', 'repp_skpengujita', 'repp_rekappembimbingta', 'repp_distgsakhir',
|
|
'repp_daftarwisuda', 'repp_yudisium', 'repp_bukuwisuda',
|
|
];
|
|
|
|
private TugasAkhirReports $reports;
|
|
|
|
protected function setUp(): void
|
|
{
|
|
parent::setUp();
|
|
|
|
$this->useLegacyDatabase();
|
|
$this->seedThesisData();
|
|
$this->reports = app(TugasAkhirReports::class);
|
|
}
|
|
|
|
private function seedThesisData(): void
|
|
{
|
|
$db = DB::connection('untan');
|
|
foreach (['tmplahir' => fn (Blueprint $t) => $t->string('tmplahir')->nullable(), 'tgllahir' => fn (Blueprint $t) => $t->date('tgllahir')->nullable()] as $column => $add) {
|
|
if (! Schema::connection('untan')->hasColumn('t_mahasiswa', $column)) {
|
|
Schema::connection('untan')->table('t_mahasiswa', fn (Blueprint $t) => $add($t));
|
|
}
|
|
}
|
|
|
|
$db->table('t_bagian')->insert([
|
|
['idbagian' => 71, 'idbagian_induk' => 5, 'idjenisbagian' => 3, 'namabagian' => 'Prodi Uji A'],
|
|
['idbagian' => 72, 'idbagian_induk' => 5, 'idjenisbagian' => 3, 'namabagian' => 'Prodi Uji B'],
|
|
]);
|
|
$db->table('t_angkatanmhs')->insert([['idangkatan' => 7001, 'tahun' => 2019, 'semester' => 1], ['idangkatan' => 7002, 'tahun' => 2020, 'semester' => 1]]);
|
|
$db->table('t_pegawai')->insert([
|
|
['idpegawai' => 7101, 'nip' => '1980', 'nama' => 'Andi Pembimbing', 'gelardepan' => 'Dr.', 'gelarbelakang' => 'M.T.'],
|
|
['idpegawai' => 7102, 'nip' => '1981', 'nama' => 'Budi Penguji', 'gelardepan' => '', 'gelarbelakang' => ''],
|
|
['idpegawai' => 7103, 'nip' => 'Admin', 'nama' => 'Admin', 'gelardepan' => '', 'gelarbelakang' => ''],
|
|
]);
|
|
$db->table('t_periodekuliah')->insert([
|
|
['idperiode' => 7301, 'thakad' => '2022/2023', 'semester' => 1, 'perkuliahan' => 1],
|
|
['idperiode' => 7302, 'thakad' => '2022/2023', 'semester' => 2, 'perkuliahan' => 1],
|
|
]);
|
|
$db->table('t_periodekuliahaktif')->insert(['idprogdi' => 71, 'idperiode' => 7302]);
|
|
|
|
$student = fn (int $id, string $nim, string $nama, int $prodi, int $angkatan, int $status, ?int $wisuda = null, array $extra = []): array => [
|
|
'idmahasiswa' => $id, 'nim' => $nim, 'nama' => $nama, 'idprogdi' => $prodi, 'idangkatan' => $angkatan, 'stataktif' => $status, 'idperiodewisuda' => $wisuda,
|
|
] + $extra;
|
|
foreach ([
|
|
$student(7201, 'T71001', 'Ani Satu', 71, 7001, 2, 7401, ['tmplahir' => 'Pontianak', 'tgllahir' => '2000-05-17', 'nmr_ijazah' => 'IJ-7201', 'nmr_skdekan' => 'SK/7201', 'tgl_skdekan' => '2023-03-30', 'tgl_lulus' => '2023-03-31']),
|
|
$student(7202, 'T71002', 'Budi Dua', 71, 7002, 1),
|
|
$student(7203, 'T71003', 'Cici Tiga', 71, 7002, 3),
|
|
$student(7204, 'T72001', 'Dedi Luar', 72, 7001, 2, 7402),
|
|
$student(7205, 'T71005', 'Eko Lima', 71, 7001, 2, 7401),
|
|
] as $row) {
|
|
$db->table('t_mahasiswa')->insert($row);
|
|
}
|
|
$db->table('t_skripsi')->insert([
|
|
['idmahasiswa' => 7201, 'judul' => 'Judul Ani', 'pembimbing1' => 7101, 'pembimbing2' => 7103, 'penguji1' => 7102, 'penguji2' => null, 'tglmulai' => '2022-09-01', 'tgllulus' => '2023-03-15'],
|
|
['idmahasiswa' => 7202, 'judul' => 'Judul Budi', 'pembimbing1' => 7101, 'pembimbing2' => null, 'penguji1' => null, 'penguji2' => null, 'tglmulai' => '2023-03-01', 'tgllulus' => null],
|
|
['idmahasiswa' => 7203, 'judul' => null, 'pembimbing1' => null, 'pembimbing2' => null, 'penguji1' => null, 'penguji2' => null, 'tglmulai' => '2023-04-01', 'tgllulus' => null],
|
|
['idmahasiswa' => 7204, 'judul' => 'Judul Dedi', 'pembimbing1' => 7101, 'pembimbing2' => null, 'penguji1' => 7102, 'penguji2' => null, 'tglmulai' => '2022-09-05', 'tgllulus' => '2023-03-20'],
|
|
['idmahasiswa' => 7205, 'judul' => 'Judul Eko', 'pembimbing1' => 7102, 'pembimbing2' => null, 'penguji1' => 7101, 'penguji2' => null, 'tglmulai' => '0001-01-01', 'tgllulus' => '2023-03-16'],
|
|
]);
|
|
|
|
$db->table('t_matakuliah')->insert([
|
|
['idmatakuliah' => 7501, 'kodemk' => 'SK1', 'namamk' => 'Skripsi', 'sks' => 6, 'tipe' => 2],
|
|
['idmatakuliah' => 7502, 'kodemk' => 'MK2', 'namamk' => 'Biasa', 'sks' => 3, 'tipe' => 0],
|
|
]);
|
|
$kst = fn (int $mhs, int $mk, int $periode, int $stat, ?string $huruf, ?float $total, ?float $mutu): array => [
|
|
'idmahasiswa' => $mhs, 'idjadwal' => 1, 'idmatakuliah' => $mk, 'idperiode' => $periode, 'stat' => $stat, 'nilaihuruf' => $huruf, 'nilaitotal' => $total, 'nilaimutu' => $mutu,
|
|
];
|
|
$db->table('t_kst')->insert([
|
|
$kst(7201, 7501, 7302, 1, 'A', 85, 4),
|
|
$kst(7202, 7501, 7302, 3, null, null, null),
|
|
$kst(7203, 7501, 7302, 0, null, null, null),
|
|
$kst(7204, 7501, 7302, 1, 'B', 70, 3),
|
|
$kst(7201, 7502, 7302, 1, 'A', 90, 4),
|
|
$kst(7201, 7501, 7301, 1, 'B', 72, 3),
|
|
]);
|
|
|
|
$db->table('t_periodewisuda')->insert([
|
|
['idperiode' => 7401, 'kdperiode' => '20223', 'namaperiode' => '2022/2023 Periode III', 'tgl_wisuda' => '2023-04-01'],
|
|
['idperiode' => 7402, 'kdperiode' => '20224', 'namaperiode' => '2022/2023 Periode IV', 'tgl_wisuda' => null],
|
|
]);
|
|
$db->table('t_evaluasi_rekap')->insert([
|
|
['idmahasiswa' => 7201, 'jmlsks' => 144, 'jmlmutusks' => 500],
|
|
['idmahasiswa' => 7204, 'jmlsks' => 100, 'jmlmutusks' => 390],
|
|
]);
|
|
$db->table('t_predikatkelulusan')->insert([
|
|
['idpredikat' => 902, 'ipkmin' => 3.51, 'ipkmax' => 4, 'predikat' => 'Dengan Pujian'],
|
|
['idpredikat' => 903, 'ipkmin' => 3.01, 'ipkmax' => 3.5, 'predikat' => 'Sangat Memuaskan'],
|
|
]);
|
|
}
|
|
|
|
private function context(array $prodi = [71]): ReportContext
|
|
{
|
|
$names = DB::connection('untan')->table('t_bagian')->whereIn('idbagian', $prodi)->pluck('namabagian', 'idbagian')->all();
|
|
|
|
return new ReportContext(1, 'staf', $prodi, $names);
|
|
}
|
|
|
|
private function report(string $slug, array $params = [], ?ReportContext $context = null, int $limit = 100): ReportResult
|
|
{
|
|
return $this->reports->run($slug, $params, $context ?? $this->context(), $limit);
|
|
}
|
|
|
|
/** @return list<string|null> */
|
|
private function column(ReportResult $result, string $key): array
|
|
{
|
|
return array_column($result->rows, $key);
|
|
}
|
|
|
|
private function keys(ReportResult $result): array
|
|
{
|
|
return array_column($result->columns, 'key');
|
|
}
|
|
|
|
public function test_slugs_hanya_yang_bersumber(): void
|
|
{
|
|
$this->assertSame(self::IMPLEMENTED, $this->reports->slugs());
|
|
foreach (['repp_proposalskripsi', 'repp_jadwalujita', 'repp_beritaacaraajuta', 'repp_nilaiproposalta', 'repp_monitoringsyaratta', 'repp_monitoringproporsalta'] as $slug) {
|
|
$this->assertNotContains($slug, $this->reports->slugs());
|
|
}
|
|
}
|
|
|
|
public function test_definisi_valid(): void
|
|
{
|
|
foreach ($this->reports->slugs() as $slug) {
|
|
$params = $this->reports->definition($slug, $this->context())['params'];
|
|
$names = array_column($params, 'name');
|
|
$this->assertSame($names, array_values(array_unique($names)), $slug);
|
|
$this->assertEmpty(array_intersect($names, ['tampil', 'kop']), $slug);
|
|
foreach ($params as $param) {
|
|
$this->assertContains($param['type'], ['select', 'text', 'number', 'date', 'check'], $slug);
|
|
if ($param['type'] === 'select') {
|
|
$this->assertIsArray($param['options'], $slug);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public function test_opsi_dan_parameter_wajib(): void
|
|
{
|
|
$skripsi = collect($this->reports->definition('repp_skripsi', $this->context())['params'])->keyBy('name');
|
|
$this->assertSame([71 => 'Prodi Uji A'], $skripsi['prodi']['options']);
|
|
$this->assertSame([2020 => '2020', 2019 => '2019'], $skripsi['angkatan']['options']);
|
|
$this->assertSame([7302 => '2022/2023 Genap', 7301 => '2022/2023 Ganjil'], $skripsi['periode']['options']);
|
|
|
|
$total = collect($this->reports->definition('repp_totalmhsskripsi', $this->context())['params'])->keyBy('name');
|
|
$this->assertTrue($total['periode']['required']);
|
|
$this->assertSame(7302, $total['periode']['default']);
|
|
|
|
$buku = collect($this->reports->definition('repp_bukuwisuda', $this->context())['params'])->keyBy('name');
|
|
$this->assertTrue($buku['prodi']['required'] && $buku['periode_wisuda']['required']);
|
|
$this->assertSame([7401 => '20223 (2022/2023 Periode III)'], $buku['periode_wisuda']['options']);
|
|
|
|
$dist = collect($this->reports->definition('repp_distgsakhir', $this->context())['params'])->keyBy('name');
|
|
$this->assertTrue($dist['tgl_awal']['required'] && $dist['tgl_akhir']['required']);
|
|
}
|
|
|
|
public function test_skripsi_daftar_dan_cakupan_prodi(): void
|
|
{
|
|
$result = $this->report('repp_skripsi');
|
|
|
|
$this->assertSame(['nim', 'nama', 'prodi', 'angkatan', 'judul', 'pembimbing1', 'pembimbing2', 'penguji1', 'penguji2', 'mulai', 'lulus_ujian', 'tahap', 'status'], $this->keys($result));
|
|
$this->assertEqualsCanonicalizing(['T71001', 'T71002', 'T71003', 'T71005'], $this->column($result, 'nim'));
|
|
$this->assertNull($result->total);
|
|
|
|
$ani = collect($result->rows)->firstWhere('nim', 'T71001');
|
|
$this->assertSame('Prodi Uji A', $ani['prodi']);
|
|
$this->assertSame(2019, $ani['angkatan']);
|
|
$this->assertSame('Judul Ani', $ani['judul']);
|
|
$this->assertSame('Dr. Andi Pembimbing, M.T.', $ani['pembimbing1']);
|
|
$this->assertNull($ani['pembimbing2'], 'akun Admin bukan dosen');
|
|
$this->assertSame('Budi Penguji', $ani['penguji1']);
|
|
$this->assertSame('01-09-2022', $ani['mulai']);
|
|
$this->assertSame('15-03-2023', $ani['lulus_ujian']);
|
|
$this->assertSame('Lulus Ujian', $ani['tahap']);
|
|
$this->assertSame('Lulus', $ani['status']);
|
|
|
|
$eko = collect($result->rows)->firstWhere('nim', 'T71005');
|
|
$this->assertNull($eko['mulai'], 'tanggal rusak dianggap tidak tercatat');
|
|
$this->assertSame('Keluar', collect($result->rows)->firstWhere('nim', 'T71003')['status']);
|
|
}
|
|
|
|
public function test_skripsi_filter(): void
|
|
{
|
|
$this->assertEqualsCanonicalizing(['T71002', 'T71003'], $this->column($this->report('repp_skripsi', ['angkatan' => 2020]), 'nim'));
|
|
$this->assertEqualsCanonicalizing(['T71001', 'T71005'], $this->column($this->report('repp_skripsi', ['status' => 'lulus']), 'nim'));
|
|
$this->assertSame(['T71002'], $this->column($this->report('repp_skripsi', ['status' => 'aktif']), 'nim'));
|
|
$this->assertSame(['T71003'], $this->column($this->report('repp_skripsi', ['status' => 'keluar']), 'nim'));
|
|
$this->assertEqualsCanonicalizing(['T71001', 'T71005'], $this->column($this->report('repp_skripsi', ['tahap' => 'ujian']), 'nim'));
|
|
$this->assertEqualsCanonicalizing(['T71002', 'T71003'], $this->column($this->report('repp_skripsi', ['periode' => 7302]), 'nim'));
|
|
$this->assertSame(['T71001'], $this->column($this->report('repp_skripsi', ['periode' => 7301]), 'nim'));
|
|
$this->assertSame(['T71002'], $this->column($this->report('repp_skripsi', ['mahasiswa' => 'budi']), 'nim'));
|
|
$this->assertSame([], $this->report('repp_skripsi', ['prodi' => 72])->rows, 'prodi di luar cakupan tidak muncul');
|
|
}
|
|
|
|
public function test_skripsi_limit_dan_total(): void
|
|
{
|
|
$result = $this->report('repp_skripsi', [], null, 2);
|
|
|
|
$this->assertCount(2, $result->rows);
|
|
$this->assertSame(4, $result->total);
|
|
$this->assertTrue($result->truncated());
|
|
$this->assertContains('Jumlah: 4 tugas akhir', $result->summary);
|
|
}
|
|
|
|
public function test_rekap_mahasiswa_tugas_akhir(): void
|
|
{
|
|
$result = $this->report('repp_mhsskripsi');
|
|
|
|
$this->assertSame(['prodi', 'angkatan', 'jumlah', 'bimbingan', 'ujian'], $this->keys($result));
|
|
$this->assertSame([
|
|
['prodi' => 'Prodi Uji A', 'angkatan' => 2020, 'jumlah' => 2, 'bimbingan' => 2, 'ujian' => 0],
|
|
['prodi' => 'Prodi Uji A', 'angkatan' => 2019, 'jumlah' => 2, 'bimbingan' => 0, 'ujian' => 2],
|
|
], $result->rows);
|
|
|
|
$genap = $this->report('repp_mhsskripsi', ['periode' => 7302]);
|
|
$this->assertSame([2020], $this->column($genap, 'angkatan'));
|
|
$this->assertSame([2], $this->column($genap, 'jumlah'));
|
|
|
|
$both = $this->report('repp_mhsskripsi', [], $this->context([71, 72]));
|
|
$this->assertContains('Prodi Uji B', $this->column($both, 'prodi'));
|
|
}
|
|
|
|
public function test_jumlah_mahasiswa_tugas_akhir_dari_krs(): void
|
|
{
|
|
$result = $this->report('repp_totalmhsskripsi', ['periode' => 7302]);
|
|
|
|
$this->assertSame(['prodi', 'peserta', 'bernilai', 'belum'], $this->keys($result));
|
|
$this->assertSame([['prodi' => 'Prodi Uji A', 'peserta' => 2, 'bernilai' => 1, 'belum' => 1]], $result->rows);
|
|
$this->assertContains('Periode: 2022/2023 Genap', $result->summary);
|
|
|
|
$both = $this->report('repp_totalmhsskripsi', ['periode' => 7302], $this->context([71, 72]));
|
|
$this->assertSame(['Prodi Uji A', 'Prodi Uji B'], $this->column($both, 'prodi'));
|
|
$this->assertSame([], $this->report('repp_totalmhsskripsi')->rows, 'periode wajib');
|
|
}
|
|
|
|
public function test_bimbingan_tugas_akhir(): void
|
|
{
|
|
$result = $this->report('repp_bimbinganta', ['prodi' => 71]);
|
|
|
|
$this->assertCount(4, $result->rows);
|
|
$ani = collect($result->rows)->firstWhere('nim', 'T71001');
|
|
$this->assertSame('Dr. Andi Pembimbing, M.T. (1980)', $ani['pembimbing1']);
|
|
$this->assertNull($ani['pembimbing2']);
|
|
$this->assertSame(['T71002'], $this->column($this->report('repp_bimbinganta', ['prodi' => 71, 'status' => 'aktif']), 'nim'));
|
|
$this->assertSame([], $this->report('repp_bimbinganta', ['prodi' => 72])->rows);
|
|
}
|
|
|
|
public function test_nilai_tugas_akhir_dari_krs(): void
|
|
{
|
|
$result = $this->report('repp_nilaiujiskripsi', ['periode' => 7302]);
|
|
|
|
$this->assertEqualsCanonicalizing(['T71001', 'T71002'], $this->column($result, 'nim'));
|
|
$ani = collect($result->rows)->firstWhere('nim', 'T71001');
|
|
$this->assertSame('SK1 Skripsi', $ani['matakuliah']);
|
|
$this->assertSame('A', $ani['nilai_huruf']);
|
|
$this->assertSame(85.0, (float) $ani['nilai_angka']);
|
|
$this->assertSame(4.0, (float) $ani['mutu']);
|
|
$this->assertSame('Budi Penguji', $ani['penguji1']);
|
|
$this->assertNull(collect($result->rows)->firstWhere('nim', 'T71002')['nilai_huruf']);
|
|
|
|
$this->assertSame(['T71001'], $this->column($this->report('repp_nilaiujiskripsi', ['periode' => 7301]), 'nim'));
|
|
$this->assertSame(['T71002'], $this->column($this->report('repp_nilaiujiskripsi', ['periode' => 7302, 'angkatan' => 2020]), 'nim'));
|
|
}
|
|
|
|
public function test_berita_acara_ujian(): void
|
|
{
|
|
$result = $this->report('repp_beritaacarata');
|
|
|
|
$this->assertSame(['T71005', 'T71001'], $this->column($result, 'nim'), 'terbaru dulu; prodi lain tidak muncul');
|
|
$ani = collect($result->rows)->firstWhere('nim', 'T71001');
|
|
$this->assertSame('15-03-2023', $ani['tgl_ujian']);
|
|
$this->assertSame('Dr. Andi Pembimbing, M.T.', $ani['pembimbing']);
|
|
$this->assertSame('Budi Penguji', $ani['penguji']);
|
|
$this->assertSame('A', $ani['nilai'], 'nilai terbaik dari KRS tugas akhir');
|
|
|
|
$this->assertSame(['T71005'], $this->column($this->report('repp_beritaacarata', ['tgl_awal' => '2023-03-16']), 'nim'));
|
|
$this->assertSame(['T71001'], $this->column($this->report('repp_beritaacarata', ['tgl_akhir' => '2023-03-15']), 'nim'));
|
|
|
|
$this->expectException(PortalException::class);
|
|
$this->report('repp_beritaacarata', ['tgl_awal' => '2023-04-01', 'tgl_akhir' => '2023-03-01']);
|
|
}
|
|
|
|
public function test_sk_pembimbing_dan_penguji(): void
|
|
{
|
|
$pembimbing = $this->report('repp_skpembimbingta');
|
|
$this->assertEqualsCanonicalizing(['T71001', 'T71002', 'T71005'], $this->column($pembimbing, 'nim'));
|
|
$this->assertSame(['nim', 'nama', 'prodi', 'angkatan', 'judul', 'tanggal', 'dosen1', 'dosen2'], $this->keys($pembimbing));
|
|
$this->assertSame(['T71002'], $this->column($this->report('repp_skpembimbingta', ['periode' => 7302]), 'nim'));
|
|
$this->assertSame(['T71001'], $this->column($this->report('repp_skpembimbingta', ['mahasiswa' => 'ani']), 'nim'));
|
|
|
|
$penguji = $this->report('repp_skpengujita');
|
|
$this->assertEqualsCanonicalizing(['T71001', 'T71005'], $this->column($penguji, 'nim'));
|
|
$ani = collect($penguji->rows)->firstWhere('nim', 'T71001');
|
|
$this->assertSame('15-03-2023', $ani['tanggal']);
|
|
$this->assertSame('Budi Penguji (1981)', $ani['dosen1']);
|
|
$this->assertEqualsCanonicalizing(['T71001', 'T71005'], $this->column($this->report('repp_skpengujita', ['periode' => 7302]), 'nim'));
|
|
$this->assertSame([], $this->report('repp_skpengujita', ['periode' => 7301])->rows);
|
|
}
|
|
|
|
public function test_rekap_pembimbing(): void
|
|
{
|
|
$result = $this->report('repp_rekappembimbingta');
|
|
|
|
$this->assertSame(['nip', 'dosen', 'pb1', 'pb2', 'total', 'aktif', 'lulus'], $this->keys($result));
|
|
$this->assertSame([
|
|
['nip' => '1980', 'dosen' => 'Dr. Andi Pembimbing, M.T.', 'pb1' => 2, 'pb2' => 0, 'total' => 2, 'aktif' => 1, 'lulus' => 1],
|
|
['nip' => '1981', 'dosen' => 'Budi Penguji', 'pb1' => 1, 'pb2' => 0, 'total' => 1, 'aktif' => 0, 'lulus' => 1],
|
|
], $result->rows, 'mahasiswa prodi lain dan akun Admin tidak dihitung');
|
|
|
|
$this->assertSame(['1980'], $this->column($this->report('repp_rekappembimbingta', ['mahasiswa' => 'budi']), 'nip'));
|
|
$this->assertSame([], $this->report('repp_rekappembimbingta', [], $this->context([]))->rows);
|
|
}
|
|
|
|
public function test_distribusi_dosen(): void
|
|
{
|
|
$result = $this->report('repp_distgsakhir', ['tgl_awal' => '2022-08-01', 'tgl_akhir' => '2023-12-31']);
|
|
|
|
$this->assertSame(['nip', 'dosen', 'pb1', 'pb2', 'pj1', 'pj2', 'total'], $this->keys($result));
|
|
$this->assertSame([
|
|
['nip' => '1980', 'dosen' => 'Dr. Andi Pembimbing, M.T.', 'pb1' => 2, 'pb2' => 0, 'pj1' => 0, 'pj2' => 0, 'total' => 2],
|
|
['nip' => '1981', 'dosen' => 'Budi Penguji', 'pb1' => 0, 'pb2' => 0, 'pj1' => 1, 'pj2' => 0, 'total' => 1],
|
|
], $result->rows);
|
|
|
|
$this->assertSame(['1980'], $this->column($this->report('repp_distgsakhir', ['tgl_awal' => '2023-03-01', 'tgl_akhir' => '2023-12-31']), 'nip'));
|
|
$this->assertSame(['1981'], $this->column($this->report('repp_distgsakhir', ['tgl_awal' => '2022-08-01', 'tgl_akhir' => '2023-12-31', 'dosen' => 'budi']), 'nip'));
|
|
$this->assertSame([], $this->report('repp_distgsakhir', ['tgl_awal' => '2022-08-01', 'tgl_akhir' => '2023-12-31', 'status' => 'keluar'])->rows);
|
|
}
|
|
|
|
public function test_daftar_wisuda(): void
|
|
{
|
|
$result = $this->report('repp_daftarwisuda', ['periode_wisuda' => 7401]);
|
|
|
|
$this->assertSame(['T71001', 'T71005'], $this->column($result, 'nim'), 'lulusan prodi lain tidak muncul');
|
|
$ani = $result->rows[0];
|
|
$this->assertSame('20223 (2022/2023 Periode III)', $ani['periode']);
|
|
$this->assertSame('01-04-2023', $ani['tgl_wisuda']);
|
|
$this->assertSame(3.47, $ani['ipk']);
|
|
$this->assertSame('Sangat Memuaskan', $ani['predikat']);
|
|
$this->assertSame('IJ-7201', $ani['ijazah']);
|
|
$this->assertNull($result->rows[1]['ipk'], 'tanpa rekap evaluasi');
|
|
$this->assertNull($result->rows[1]['predikat']);
|
|
|
|
$this->assertSame([], $this->report('repp_daftarwisuda', ['periode_wisuda' => 7402])->rows);
|
|
$this->assertSame([], $this->report('repp_daftarwisuda')->rows, 'periode wajib');
|
|
$this->assertContains('Jumlah: 2 lulusan', $result->summary);
|
|
}
|
|
|
|
public function test_yudisium(): void
|
|
{
|
|
$result = $this->report('repp_yudisium', ['periode_wisuda' => 7401]);
|
|
|
|
$this->assertSame(['nim', 'nama', 'prodi', 'angkatan', 'periode', 'tgl_lulus', 'sk', 'tgl_sk', 'sks', 'ipk', 'predikat'], $this->keys($result));
|
|
$ani = $result->rows[0];
|
|
$this->assertSame('31-03-2023', $ani['tgl_lulus']);
|
|
$this->assertSame('SK/7201', $ani['sk']);
|
|
$this->assertSame('30-03-2023', $ani['tgl_sk']);
|
|
$this->assertSame(144, $ani['sks']);
|
|
$this->assertSame(3.47, $ani['ipk']);
|
|
$this->assertNull($result->rows[1]['sks']);
|
|
|
|
$this->assertSame([], $this->report('repp_yudisium', ['periode_wisuda' => 7401, 'angkatan' => 2020])->rows);
|
|
$this->assertSame(['T71005'], $this->column($this->report('repp_yudisium', ['periode_wisuda' => 7401, 'mahasiswa' => 'eko']), 'nim'));
|
|
}
|
|
|
|
public function test_buku_wisuda(): void
|
|
{
|
|
$result = $this->report('repp_bukuwisuda', ['periode_wisuda' => 7401, 'prodi' => 71]);
|
|
|
|
$this->assertSame(['T71001', 'T71005'], $this->column($result, 'nim'));
|
|
$ani = $result->rows[0];
|
|
$this->assertSame('Pontianak, 17-05-2000', $ani['ttl']);
|
|
$this->assertSame(3.47, $ani['ipk']);
|
|
$this->assertSame('Judul Ani', $ani['judul']);
|
|
$this->assertSame('15-03-2023', $ani['tgl_ujian']);
|
|
$this->assertNull($result->rows[1]['ttl']);
|
|
|
|
$this->assertSame([], $this->report('repp_bukuwisuda', ['periode_wisuda' => 7401, 'prodi' => 72])->rows, 'prodi di luar cakupan');
|
|
$this->assertContains('Program studi: Prodi Uji A', $result->summary);
|
|
}
|
|
|
|
public function test_prodi_kosong_menghasilkan_hasil_kosong(): void
|
|
{
|
|
$empty = $this->context([]);
|
|
$params = ['periode' => 7302, 'periode_wisuda' => 7401, 'prodi' => 71, 'tgl_awal' => '2022-01-01', 'tgl_akhir' => '2023-12-31'];
|
|
|
|
foreach ($this->reports->slugs() as $slug) {
|
|
$result = $this->report($slug, $params, $empty);
|
|
$this->assertSame([], $result->rows, $slug);
|
|
$this->assertNotEmpty($result->columns, $slug);
|
|
}
|
|
}
|
|
}
|