public getCredentialObject ( $userId = null ) |
public function getCredentialObject($userId = null)
{
if ($userId == null) {
$credObj = $this->credentialHashmap[$this->defaultAccountName];
} else {
if (array_key_exists($userId, $this->credentialHashmap)) {
$credObj = $this->credentialHashmap[$userId];
}
}
if (empty($credObj)) {
throw new PPInvalidCredentialException("Invalid userId {$userId}");
}
return $credObj;
}
/** * @test */ public function testGetRestCredentialObject() { $cred = $this->object->getCredentialObject('acct3'); $this->assertNotNull($cred); $this->assertArrayHasKey('clientId', $cred); $this->assertEquals($this->config['acct3.ClientId'], $cred['clientId']); $this->assertArrayHasKey('clientSecret', $cred); $this->assertEquals($this->config['acct3.ClientSecret'], $cred['clientSecret']); }