/** * @vcr OrdinanceTests/testReadOrdinancesForbidden.json * @link https://familysearch.org/developers/docs/api/ordinances/Read_Ordinances_%28Access_Forbidden%29_usecase */ public function testReadOrdinancesForbidden() { $factory = new StateFactory(); $collectionState = $factory->newCollectionState()->authenticateViaOAuth2Password('general_public_user', '1234pass', SandboxCredentials::API_KEY); $response = $collectionState->getClient()->get($this->ordinanceUri, ['headers' => ['Authorization' => "Bearer " . $collectionState->getAccessToken(), 'Accept' => Gedcomx::JSON_MEDIA_TYPE, 'Content-Type' => Gedcomx::JSON_MEDIA_TYPE]]); $this->assertEquals(HttpStatus::FORBIDDEN, $response->getStatusCode(), 'Error with invalid Ordinance test. Returned: ' . HttpStatus::getText($response->getStatusCode()) . "(" . $response->getStatusCode() . ")"); }
/** * @vcr DiscoveryTests/testReadFamilySearchHistoricalRecordsArchive.json * @link https://familysearch.org/developers/docs/api/memories/Read_FamilySearch_Historical_Records_Archive_usecase */ public function testReadFamilySearchHistoricalRecordsArchive() { $factory = new StateFactory(); $collection = $factory->newDiscoveryState(); $subsState = $collection->readSubcollections(); $collections = $subsState->getCollections(); $link = null; foreach ($collections as $record) { if ($record->getId() == "FSHRA") { $link = $record->getLink(Rel::SELF); break; } } $this->assertNotEmpty($link, 'Place Authority link not found'); $dateState = $factory->newCollectionState($link->getHref()); $this->assertEquals(HttpStatus::OK, $dateState->getStatus(), $this->buildFailMessage(__METHOD__ . "(Read place collection)", $dateState)); }
/** * @link https://familysearch.org/developers/docs/api/authentication/Obtain_Access_Token_without_Authenticating_usecase */ public function testObtainAccessTokenWithoutAuthenticating() { $factory = new StateFactory(); $collectionState = $factory->newCollectionState()->authenticateViaOAuth2WithoutCredentials('0.0.0.0', $this->clientId); $this->assertNotEmpty($collectionState->getAccessToken()); }