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)); } }