seed(DatabaseSeeder::class); $this->assertDatabaseCount('positions', 9); $this->assertDatabaseCount('elections', 1); $this->assertDatabaseCount('bahagian_pilihanrayas', 1); $this->assertDatabaseCount('daerah_mengundis', 1); $this->assertDatabaseCount('pusat_mengundis', 1); $this->assertDatabaseCount('saluran_mengundis', 3); $this->assertDatabaseCount('position_quotas', 17); $this->assertDatabaseCount('staff_assignments', 3); $election = Election::query()->where('code', 'PRN2026')->firstOrFail(); $pusat = PusatMengundi::query()->where('code', 'PM001')->firstOrFail(); $ppm = User::query()->where('email', 'ppm@prn.local')->firstOrFail(); $this->assertTrue($ppm->hasRole('PPM')); $this->assertTrue($ppm->hasRole('KTM')); $this->assertSame($election->id, $pusat->election_id); $this->assertSame(3, $pusat->saluranMengundis()->count()); $this->assertNotNull($pusat->wheelchairAllocation); $ppmPosition = Position::query()->where('code', 'PPM')->firstOrFail(); $ktmPosition = Position::query()->where('code', 'KTM')->firstOrFail(); $this->assertTrue(PositionQuota::query() ->where('election_id', $election->id) ->where('pusat_mengundi_id', $pusat->id) ->where('position_id', $ppmPosition->id) ->whereNull('saluran_mengundi_id') ->exists()); $this->assertTrue(StaffAssignment::query() ->where('election_id', $election->id) ->where('user_id', $ppm->id) ->where('position_id', $ppmPosition->id) ->whereNull('saluran_mengundi_id') ->exists()); $this->assertTrue(StaffAssignment::query() ->where('election_id', $election->id) ->where('user_id', $ppm->id) ->where('position_id', $ktmPosition->id) ->whereNotNull('saluran_mengundi_id') ->exists()); } }