Ejemplo n.º 1
0
 /**
  * @link https://familysearch.org/developers/docs/api/sources/Move_Sources_to_a_User-Defined_Collection_usecase
  */
 public function testMoveSourcesToAUserDefinedCollection()
 {
     $factory = new FamilySearchStateFactory();
     /** @var FamilySearchCollectionState $collection */
     $collection = $this->collectionState($factory, "https://sandbox.familysearch.org/platform/collections/sources");
     $sd = new SourceDescription();
     $citation = new SourceCitation();
     $citation->setValue("\"United States Census, 1900.\" database and digital images, FamilySearch (https://familysearch.org/: accessed 17 Mar 2012), Ethel Hollivet, 1900; citing United States Census Office, Washington, D.C., 1900 Population Census Schedules, Los Angeles, California, population schedule, Los Angeles Ward 6, Enumeration District 58, p. 20B, dwelling 470, family 501, FHL microfilm 1,240,090; citing NARA microfilm publication T623, roll 90.");
     $sd->setCitations(array($citation));
     $title = new TextValue();
     $title->setValue("1900 US Census, Ethel Hollivet");
     $sd->setTitles(array($title));
     $note = new Note();
     $note->setText("Ethel Hollivet (line 75) with husband Albert Hollivet (line 74); also in the dwelling: step-father Joseph E Watkins (line 72), mother Lina Watkins (line 73), and grandmother -- Lina's mother -- Mary Sasnett (line 76).  Albert's mother and brother also appear on this page -- Emma Hollivet (line 68), and Eddie (line 69).");
     $sd->setNotes(array($note));
     $attribution = new Attribution();
     $contributor = new ResourceReference();
     $contributor->setResource("https://familysearch.org/platform/users/agents/MM6M-8QJ");
     $contributor->setResourceId("MM6M-8QJ");
     $attribution->setContributor($contributor);
     $attribution->setModified(time());
     $attribution->setChangeMessage("This is the change message");
     $sd->SetAttribution($attribution);
     /** @var FamilySearchSourceDescriptionState $description */
     $description = $collection->addSourceDescription($sd);
     $this->queueForDelete($description);
     $this->assertEquals(HttpStatus::CREATED, $description->getResponse()->getStatusCode());
     $description = $description->get();
     $this->assertEquals(HttpStatus::OK, $description->getResponse()->getStatusCode());
     /** @var CollectionState $subcollection */
     $c = new Collection();
     $c->setTitle($this->faker->sha1);
     $subcollection = $collection->addCollection($c)->get();
     $this->queueForDelete($subcollection);
     /** @var FamilySearchSourceDescriptionState $state */
     $state = $description->moveToCollection($subcollection);
     $this->assertNotNull($state->ifSuccessful());
     $this->assertEquals(HttpStatus::NO_CONTENT, $state->getResponse()->getStatusCode());
     // Ensure it doesn't exist in the old collection
     $rootCollection = $this->getRootCollection($collection);
     $found = $this->findInCollection($description->getSourceDescription(), $rootCollection->readSourceDescriptions()->getEntity()->getSourceDescriptions());
     $this->assertFalse($found);
     // Ensure it exists in the new collection
     $found = $this->findInCollection($description->getSourceDescription(), $subcollection->readSourceDescriptions()->getEntity()->getSourceDescriptions());
     $this->assertTrue($found);
 }
Ejemplo n.º 2
0
 /**
  * @return \Gedcomx\Source\SourceDescription
  */
 private function createSourceDescription()
 {
     $sd = new SourceDescription();
     $citation = new SourceCitation();
     $citation->setValue("\"United States Census, 1900.\" database and digital images, FamilySearch (https://familysearch.org/: accessed 17 Mar 2012), Ethel Hollivet, 1900; citing United States Census Office, Washington, D.C., 1900 Population Census Schedules, Los Angeles, California, population schedule, Los Angeles Ward 6, Enumeration District 58, p. 20B, dwelling 470, family 501, FHL microfilm 1,240,090; citing NARA microfilm publication T623, roll 90.");
     $sd->setCitations(array($citation));
     $title = new TextValue();
     $title->setValue("1900 US Census, Ethel Hollivet");
     $sd->setTitles(array($title));
     $note = new Note();
     $note->setText("Ethel Hollivet (line 75) with husband Albert Hollivet (line 74); also in the dwelling: step-father Joseph E Watkins (line 72), mother Lina Watkins (line 73), and grandmother -- Lina's mother -- Mary Sasnett (line 76).  Albert's mother and brother also appear on this page -- Emma Hollivet (line 68), and Eddie (line 69).");
     $sd->setNotes(array($note));
     $attribution = new Attribution();
     $rr = new ResourceReference();
     $rr->setResource("https://familysearch.org/platform/users/agents/MM6M-8QJ");
     $rr->setResourceId("MM6M-8QJ");
     $attribution->setContributor($rr);
     $attribution->setModified(time());
     $attribution->setChangeMessage("This is the change message");
     $sd->setAttribution($attribution);
     return $sd;
 }