first commit

This commit is contained in:
Saufi
2026-06-24 20:32:14 +08:00
commit 10fb30ad69
201 changed files with 21356 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
<?php
namespace Tests\Feature;
use App\Models\ReportingCycle;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class ReportingCycleTest extends TestCase
{
use RefreshDatabase;
protected function setUp(): void
{
parent::setUp();
$this->seedRolesAndPermissions();
}
public function test_reporting_year_is_calculated_from_renewal_year(): void
{
// Peraturan: pembaharuan 2028 => pelaporan 2026.
$this->assertEquals(2026, ReportingCycle::reportingYearFor(2028));
$this->assertEquals(2025, ReportingCycle::reportingYearFor(2027));
}
public function test_jpp_can_create_cycle_with_calculated_reporting_year(): void
{
$jpp = $this->makeUserWithRole('JPP Admin');
$this->actingAs($jpp)->post(route('reporting-cycles.store'), [
'renewal_year' => 2028,
'licence_period_year' => 1,
'status' => 'aktif',
])->assertRedirect();
$cycle = ReportingCycle::where('renewal_year', 2028)->first();
$this->assertNotNull($cycle);
$this->assertEquals(2026, $cycle->reporting_year);
$this->assertEquals('2026-01-01', $cycle->period_start->toDateString());
$this->assertEquals('2026-12-31', $cycle->period_end->toDateString());
}
}