policy = new AllocationPolicy; } // 5.1.17 Unit test: AllocationPolicy authorization public function test_manager_can_view_allocations() { $manager = User::factory()->create(['role' => 'manager']); $this->assertTrue($this->policy->viewAny($manager)); } public function test_manager_can_create_allocations() { $manager = User::factory()->create(['role' => 'manager']); $this->assertTrue($this->policy->create($manager)); } public function test_superuser_can_create_allocations() { $superuser = User::factory()->create(['role' => 'superuser']); $this->assertTrue($this->policy->create($superuser)); } public function test_developer_cannot_create_allocations() { $developer = User::factory()->create(['role' => 'developer']); $this->assertFalse($this->policy->create($developer)); } // 2.3 Unit test: AllocationPolicy allows untracked allocation public function test_manager_can_create_untracked_allocations() { $manager = User::factory()->create(['role' => 'manager']); // Policy should allow creating allocations (untracked is just null team_member_id) $this->assertTrue($this->policy->create($manager)); } }