Ejemplo n.º 1
0
 public function testReadPersonChangeHistoryFirstPage()
 {
     $factory = new FamilyTreeStateFactory();
     $this->collectionState($factory);
     $person = $this->createPerson();
     $this->assertEquals(HttpStatus::CREATED, $person->getResponse()->getStatusCode());
     $person = $person->get();
     $this->assertEquals(HttpStatus::OK, $person->getResponse()->getStatusCode());
     $state = $person->readChangeHistory(QueryParameter::count(10));
     $this->assertNotNull($state->ifSuccessful());
     $this->assertEquals((int) $state->getResponse()->getStatusCode(), 200);
     $this->assertNotNull($state->getPage());
     $this->assertNotNull($state->getPage()->getEntries());
     $this->assertGreaterThanOrEqual(1, count($state->getPage()->getEntries()));
 }
Ejemplo n.º 2
0
 /**
  * @vcr SearchAndMatchTests/testSearchForPersonMatches.json
  * @link https://familysearch.org/developers/docs/api/tree/Search_Persons_With_Warnings_and_Errors_usecase
  */
 public function testSearchForPersonMatches()
 {
     $factory = new FamilyTreeStateFactory();
     $collection = $this->collectionState($factory);
     $query = new GedcomxPersonSearchQueryBuilder();
     $query->fatherSurname("Heaton")->spouseSurname("Cox")->surname("Heaton")->givenName("Israel")->birthPlace("Orderville, UT")->deathDate("29 August 1936")->deathPlace("Kanab, Kane, UT")->spouseGivenName("Charlotte")->motherGivenName("Clarissa")->motherSurname("Hoyt")->gender("Male")->birthDate("30 January 1880")->fatherGivenName("Jonathan");
     $state = $collection->searchForPersonMatches($query, QueryParameter::count(2));
     $this->assertNotNull($state->ifSuccessful());
     $this->assertEquals(HttpStatus::OK, $state->getStatus());
     $this->assertNotNull($state->getResults());
     $this->assertNotNull($state->getResults()->getEntries());
     $this->assertGreaterThan(0, count($state->getResults()->getEntries()));
 }
Ejemplo n.º 3
0
 /**
  * @vcr PlacesTests/testSearchForPlaces.json
  * @link https://familysearch.org/developers/docs/api/places/Search_For_Places_usecase
  */
 public function testSearchForPlaces()
 {
     $query = new GedcomxPlaceSearchQueryBuilder();
     $query->name("Paris");
     $factory = new FamilySearchStateFactory();
     /** @var \Gedcomx\Extensions\FamilySearch\Rs\Client\FamilySearchPlaces $collection */
     $collection = $factory->newPlacesState()->authenticateViaOAuth2Password(SandboxCredentials::USERNAME, SandboxCredentials::PASSWORD, SandboxCredentials::API_KEY);
     // Only ask for 5 results so that we don't record a ton of data
     $response = $collection->searchForPlaces($query, QueryParameter::count(5));
     $this->assertEquals(HttpStatus::OK, $response->getStatus());
     $this->assertNotNull($response->getEntity(), "Search results entity is null.");
     /** @var \Gedcomx\Atom\Entry[] $results */
     $results = $response->getResults();
     $this->assertNotEmpty($results, "Search should have returned results.");
     /** @var \Gedcomx\Gedcomx $gx */
     $gx = $results[0]->getContent()->getGedcomx();
     $this->assertNotEmpty($gx->getPlaces(), "Places information missing.");
 }