/** * @link https://familysearch.org/developers/docs/api/tree/Update_Couple_Relationship_Note_usecase */ public function testDeleteCoupleRelationshipNote() { //QA Reviewed $factory = new FamilyTreeStateFactory(); $this->collectionState($factory); $person1 = $this->createPerson('male')->get(); $this->assertAttributeEquals(HttpStatus::OK, "statusCode", $person1->getResponse()); $person2 = $this->createPerson('female')->get(); $this->assertAttributeEquals(HttpStatus::OK, "statusCode", $person2->getResponse()); /* Create Relationship */ /** @var $relation RelationshipState */ $relation = $this->collectionState()->addSpouseRelationship($person1, $person2)->get(); $this->assertAttributeEquals(HttpStatus::OK, "statusCode", $relation->getResponse(), $this->buildFailMessage(__METHOD__ . "(addSpouse)", $relation)); $note = NoteBuilder::createNote(); $noted = $relation->addNote($note); $this->assertAttributeEquals(HttpStatus::CREATED, "statusCode", $noted->getResponse(), $this->buildFailMessage(__METHOD__ . "(addSpouse)", $noted)); $relation->loadNotes(); $notes = $relation->getRelationship()->getNotes(); $noted = $relation->deleteNote($notes[0]); $this->assertAttributeEquals(HttpStatus::NO_CONTENT, "statusCode", $noted->getResponse(), $this->buildFailMessage(__METHOD__ . "(addSpouse)", $noted)); $relation->delete(); $person1->delete(); $person2->delete(); }
/** * @link https://familysearch.org/developers/docs/api/tree/Delete_Note_usecase */ public function testDeleteNote() { $factory = new StateFactory(); $this->collectionState($factory); $personState = $this->createPerson(); $this->assertAttributeEquals(HttpStatus::CREATED, "statusCode", $personState->getResponse()); $note = NoteBuilder::createNote(); $noteState = $personState->addNote($note); $this->assertAttributeEquals(HttpStatus::CREATED, "statusCode", $noteState->getResponse()); $note = new Note(); $note->addLink($noteState->getLink(Rel::SELF)); $delState = $personState->deleteNote($note); $this->assertAttributeEquals(HttpStatus::NO_CONTENT, "statusCode", $delState->getResponse()); }