create([]); $this->assertTrue($emotion->primary->exists()); $this->assertTrue($emotion->secondary->exists()); } /** @test */ public function secondary_emotion_belongs_to_a_primary_emotion() { $secondaryEmotion = factory(SecondaryEmotion::class)->create([]); $this->assertTrue($secondaryEmotion->primary->exists()); } /** @test */ public function a_primary_emotion_has_multiple_emotions() { $primaryEmotion = factory(PrimaryEmotion::class)->create([]); $secondaryEmotion = factory(SecondaryEmotion::class)->create([ 'emotion_primary_id' => $primaryEmotion->id, ]); factory(Emotion::class, 3)->create([ 'emotion_primary_id' => $primaryEmotion->id, 'emotion_secondary_id' => $secondaryEmotion->id, ]); $this->assertTrue($primaryEmotion->secondaries()->exists()); $this->assertTrue($primaryEmotion->emotions()->exists()); } }