本文整理汇总了PHP中apiClient::setAuthClass方法的典型用法代码示例。如果您正苦于以下问题:PHP apiClient::setAuthClass方法的具体用法?PHP apiClient::setAuthClass怎么用?PHP apiClient::setAuthClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类apiClient
的用法示例。
在下文中一共展示了apiClient::setAuthClass方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSettersGetters
public function testSettersGetters()
{
$client = new apiClient();
$client->setClientId("client1");
$client->setClientSecret('client1secret');
$client->setState('1');
$client->setApprovalPrompt('force');
$client->setAccessType('offline');
global $apiConfig;
$this->assertEquals('client1', $apiConfig['oauth2_client_id']);
$this->assertEquals('client1secret', $apiConfig['oauth2_client_secret']);
$client->setRedirectUri('localhost');
$client->setApplicationName('me');
$client->setUseObjects(false);
$this->assertEquals('object', gettype($client->getAuth()));
$this->assertEquals('object', gettype($client->getCache()));
$this->assertEquals('object', gettype($client->getIo()));
$client->setAuthClass('apiAuthNone');
$client->setAuthClass('apiOAuth2');
try {
$client->setAccessToken(null);
die('Should have thrown an apiAuthException.');
} catch (apiAuthException $e) {
$this->assertEquals('Could not json decode the access token', $e->getMessage());
}
$token = json_encode(array('access_token' => 'token'));
$client->setAccessToken($token);
$this->assertEquals($token, $client->getAccessToken());
}