laporan: tampilkan deskripsi pelanggaran di kolom jenis (web+PDF); TEST GUARD: blokir test bila DB bukan *_test (cegah RefreshDatabase menghancurkan produksi saat config ter-cache)
This commit is contained in:
@@ -146,7 +146,12 @@
|
||||
<td>{{ $v->student?->nisn }}</td>
|
||||
<td>{{ $v->student?->full_name }}</td>
|
||||
<td>{{ $v->student?->class?->name }}</td>
|
||||
<td>{{ $v->violationType?->name }} ({{ $v->violationType?->category?->name ?? '-' }})</td>
|
||||
<td>
|
||||
<div>{{ $v->violationType?->name }} <span style="color:#666">({{ $v->violationType?->category?->name ?? '-' }})</span></div>
|
||||
@if ($v->description)
|
||||
<div style="font-size:7.5px; color:#555; margin-top:1px;">{{ $v->description }}</div>
|
||||
@endif
|
||||
</td>
|
||||
<td class="center">{{ $v->points }}</td>
|
||||
<td class="center"><span class="badge {{ $badge }}">{{ $status }}</span></td>
|
||||
</tr>
|
||||
|
||||
@@ -277,7 +277,12 @@
|
||||
<td class="px-4 py-3">
|
||||
<span class="inline-flex px-2 py-0.5 rounded-md text-xs font-semibold bg-gray-100 text-gray-600">{{ $v->student?->class?->name }}</span>
|
||||
</td>
|
||||
<td class="px-4 py-3 text-gray-600">{{ $v->violationType?->name }}</td>
|
||||
<td class="px-4 py-3">
|
||||
<div class="font-medium text-gray-700">{{ $v->violationType?->name }}</div>
|
||||
@if ($v->description)
|
||||
<div class="text-xs text-gray-400 line-clamp-2 max-w-xs mt-0.5" title="{{ $v->description }}">{{ $v->description }}</div>
|
||||
@endif
|
||||
</td>
|
||||
<td class="px-4 py-3 text-center">
|
||||
<span class="inline-flex px-2.5 py-1 rounded-full text-xs font-bold {{ $v->points >= 10 ? 'bg-rose-50 text-rose-600' : 'bg-amber-50 text-amber-700' }}">{{ $v->points }}</span>
|
||||
</td>
|
||||
|
||||
+21
-1
@@ -3,8 +3,28 @@
|
||||
namespace Tests;
|
||||
|
||||
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
abstract class TestCase extends BaseTestCase
|
||||
{
|
||||
//
|
||||
/**
|
||||
* Pengaman: pastikan test HANYA boleh jalan di database test.
|
||||
*
|
||||
* Jika konfigurasi ter-cache (config:cache) membuat test menunjuk ke
|
||||
* database produksi, RefreshDatabase akan menghancurkan data asli —
|
||||
* guard ini menghentikan suite sebelum itu terjadi.
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$dbName = config('database.connections.'.config('database.default').'.database');
|
||||
|
||||
if (! str_ends_with((string) $dbName, '_test')) {
|
||||
throw new \RuntimeException(
|
||||
"TEST DIBLOKIR: database aktif '{$dbName}' bukan database test (harus berakhiran _test). ".
|
||||
'Jalankan `php artisan config:clear` lalu ulangi test.'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user