コード例 #1
0
 public function testSaveSpousesRelationship()
 {
     $repository = $this->getRepository();
     $husband = new Persona(Persona::GENDER_MALE);
     $wife = new Persona(Persona::GENDER_FEMALE);
     $husband->addSpouse($wife);
     $repository->save($husband);
     $this->assertTableHasData('spouse_relationship', ['husband_id' => $husband->getId(), 'wife_id' => $wife->getId()]);
 }
コード例 #2
0
 public function testSpouseReflectionRelationshit()
 {
     $husband = new Persona(Persona::GENDER_MALE);
     $wife = new Persona(Persona::GENDER_FEMALE);
     $husband->addSpouse($wife);
     $this->assertContains($husband, $wife->getSpouses());
 }