コード例 #1
0
ファイル: Client.php プロジェクト: gmo/salesforce-rest-api
 /**
  * Lazy loads the access token by running authentication and setting the access token into the $this->guzzle headers
  */
 protected function initializeGuzzle()
 {
     if ($this->guzzle->getDefaultOption('headers/Authorization')) {
         return;
     }
     $this->setAccessTokenInGuzzleFromAuthentication();
 }
コード例 #2
0
 public function testHasDefaultOptionsHelperMethods()
 {
     $client = new Client();
     // With path
     $client->setDefaultOption('headers/foo', 'bar');
     $this->assertEquals('bar', $client->getDefaultOption('headers/foo'));
     // With simple key
     $client->setDefaultOption('allow_redirects', false);
     $this->assertFalse($client->getDefaultOption('allow_redirects'));
     $this->assertEquals(array('headers' => array('foo' => 'bar'), 'allow_redirects' => false), $client->getConfig('request.options'));
     $request = $client->get('/');
     $this->assertEquals('bar', $request->getHeader('foo'));
 }
コード例 #3
0
ファイル: ClientTest.php プロジェクト: teenscode/invite
 public function testHasDefaultOptionsHelperMethods()
 {
     $client = new Client();
     // With path
     $client->setDefaultOption('headers/foo', 'bar');
     $this->assertEquals('bar', $client->getDefaultOption('headers/foo'));
     // With simple key
     $client->setDefaultOption('allow_redirects', false);
     $this->assertFalse($client->getDefaultOption('allow_redirects'));
 }
コード例 #4
0
 public function testCorrectHeaderWhenAccessTokenGiven()
 {
     $provider = new DropboxLoader($this->client, 'DROPBOX FOLDER');
     $provider->enableOauthAuthentication('DROPBOX KEY', 'DROPBOX SECRET', 'DROPBOX ACCESS TOKEN');
     $this->assertEquals('Bearer DROPBOX ACCESS TOKEN', $this->client->getDefaultOption('request.options/headers/Authorization'));
 }