'Company Admin', 'email' => 'admin@company.com', 'password' => bcrypt('password'), 'type' => 'company', ]); $this->branch = Branch::create([ 'name' => 'Main Branch', 'created_by' => $companyUser->id, ]); $this->user = User::create([ 'name' => 'Test Employee', 'email' => 'testemployee@example.com', 'password' => bcrypt('password'), 'type' => 'employee', 'created_by' => $companyUser->id, 'branch_id' => $this->branch->id, ]); } public function test_users_list_route_returns_users() { $response = $this->actingAs($this->user)->getJson('/api/users/list'); $response->assertStatus(200) ->assertJsonPath('success', true); } public function test_project_unassigned_tasks_route() { $response = $this->actingAs($this->user)->getJson('/api/projects/1/unassigned-tasks'); $response->assertStatus(200) ->assertJsonPath('success', true); } public function test_direct_subtask_toggle_route() { $task = MobileTask::create([ 'title' => 'Sample Task', 'created_by' => $this->user->id, 'status' => 'todo', 'priority' => 'medium', ]); $subtask = MobileSubtask::create([ 'task_id' => $task->id, 'title' => 'Subtask 1', 'is_completed' => false, ]); $response = $this->actingAs($this->user)->postJson("/api/subtasks/{$subtask->id}/toggle"); $response->assertStatus(200) ->assertJsonPath('success', true) ->assertJsonPath('data.is_completed', true); } public function test_task_files_and_archive_routes() { $task = MobileTask::create([ 'title' => 'Archive Task', 'created_by' => $this->user->id, 'status' => 'todo', 'priority' => 'medium', ]); $filesResponse = $this->actingAs($this->user)->getJson("/api/tasks/{$task->id}/files"); $filesResponse->assertStatus(200)->assertJsonPath('success', true); $archiveResponse = $this->actingAs($this->user)->postJson("/api/tasks/{$task->id}/archive"); $archiveResponse->assertStatus(200)->assertJsonPath('data.status', 'archived'); } }