create(); $task = Task::factory()->forOrganization($organization)->create(); // Act $task->refresh(); $organizationRel = $task->organization; // Assert $this->assertNotNull($organizationRel); $this->assertTrue($organizationRel->is($organization)); } public function test_it_belongs_to_a_project(): void { // Arrange $project = Project::factory()->create(); $task = Task::factory()->forProject($project)->create(); // Act $task->refresh(); $projectRel = $task->project; // Assert $this->assertNotNull($projectRel); $this->assertTrue($projectRel->is($project)); } public function test_it_has_many_time_entries(): void { // Arrange $otherTask = Task::factory()->create(); $task = Task::factory()->create(); $timeEntries = TimeEntry::factory()->forTask($task)->count(3)->create(); $otherTimeEntries = TimeEntry::factory()->forTask($otherTask)->count(2)->create(); // Act $task->refresh(); $timeEntries = $task->timeEntries; // Assert $this->assertCount(3, $timeEntries); } }