public function testSavePersonaWithParents() { $persona = new Persona(); $father = new Persona(Persona::GENDER_MALE); $mother = new Persona(Persona::GENDER_FEMALE); $persona->setFather($father); $persona->setMother($mother); $repository = $this->getRepository(); $repository->save($persona); $this->assertTableHasData('persona', ['id' => $persona->getId(), 'father_id' => $father->getId(), 'mother_id' => $mother->getId()]); $this->assertTableHasData('persona', ['id' => $father->getId()]); $this->assertTableHasData('persona', ['id' => $mother->getId()]); }
public function testChildsForParents() { $persona = new Persona(); $father = new Persona(Persona::GENDER_MALE); $persona->setFather($father); $this->assertContains($persona, $father->getChildren()); $mother = new Persona(Persona::GENDER_FEMALE); $persona->setMother($mother); $this->assertContains($persona, $mother->getChildren()); }