create(); $this->assertTrue($timeline->vault()->exists()); } /** @test */ public function it_has_many_life_events(): void { $timeline = TimelineEvent::factory()->create(); LifeEvent::factory()->count(2)->create([ 'timeline_event_id' => $timeline->id, ]); $this->assertTrue($timeline->lifeEvents()->exists()); } /** @test */ public function it_has_many_participants(): void { $contact = Contact::factory()->create(); $timeline = TimelineEvent::factory()->create(); $timeline->participants()->sync([$contact->id]); $this->assertTrue($timeline->participants()->exists()); } /** @test */ public function it_gets_the_date_range(): void { $user = User::factory()->create(); $this->be($user); $timeline = TimelineEvent::factory()->create(); LifeEvent::factory()->create([ 'timeline_event_id' => $timeline->id, 'happened_at' => '2020-01-01', ]); $this->assertEquals( 'Jan 01, 2020', $timeline->range ); LifeEvent::factory()->create([ 'timeline_event_id' => $timeline->id, 'happened_at' => '2019-01-01', ]); $this->assertEquals( 'Jan 01, 2019 — Jan 01, 2020', $timeline->range ); LifeEvent::factory()->create([ 'timeline_event_id' => $timeline->id, 'happened_at' => '2019-03-01', ]); $this->assertEquals( 'Jan 01, 2019 — Jan 01, 2020', $timeline->range ); } }