create(); $this->assertTrue($couple->husband instanceof User); $this->assertTrue($couple->wife instanceof User); } /** @test */ public function a_couple_can_have_many_childs() { $couple = factory(Couple::class)->create(); $this->assertCount(0, $couple->childs); $child = factory(User::class)->create(); $couple->addChild($child); $child = $child->fresh(); $this->assertCount(1, $couple->fresh()->childs); $this->assertEquals($child->parent_id, $couple->id); $this->assertEquals($child->father_id, $couple->husband_id); $this->assertEquals($child->mother_id, $couple->wife_id); } /** @test */ public function a_couple_have_a_manager() { $couple = factory(Couple::class)->create(); $this->assertTrue($couple->manager instanceof User); } }