-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
Description
🎯 Objective
Update tests/Feature/PersonApiTest.php to create permissions with guard_name='sanctum' instead of defaulting to 'web' guard.
📋 Changes Required
Location
File: tests/Feature/PersonApiTest.php
Lines: ~30-40 (beforeEach hook)
Current Code
beforeEach(function (): void {
$this->tenant = Tenant::factory()->create();
$this->user = User::factory()->create(['tenant_id' => $this->tenant->id]);
$this->token = $this->user->createToken('test')->plainTextToken;
// Create test permissions (implicit 'web' guard)
Permission::create(['name' => 'employees.create']);
Permission::create(['name' => 'employees.read']);
});Target Code
beforeEach(function (): void {
$this->tenant = Tenant::factory()->create();
$this->user = User::factory()->create(['tenant_id' => $this->tenant->id]);
$this->token = $this->user->createToken('test')->plainTextToken;
// Create test permissions (explicit 'sanctum' guard)
Permission::create(['name' => 'employees.create', 'guard_name' => 'sanctum']);
Permission::create(['name' => 'employees.read', 'guard_name' => 'sanctum']);
});✅ Acceptance Criteria
- All
Permission::create()calls include'guard_name' => 'sanctum' - Tests pass locally after change
- PHPStan Level Max: 0 errors
- Laravel Pint: Clean
- No other test files affected
📊 Expected Impact
Before: All 13 tests failing with 403 Forbidden errors
After: All 13 tests pass
🔗 Related
- Parent: [EPIC] Migrate Permission System from 'web' to 'sanctum' Guard #125 (EPIC: Migrate Permission System to sanctum guard)
- Depends on: None (can be done independently)
⏱️ Effort Estimate
Time: 15-20 minutes
Complexity: Low (mechanical change, well-defined scope)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
✅ Done