当前位置: 首页>>代码示例>>PHP>>正文


PHP Client::setHttpClient方法代码示例

本文整理汇总了PHP中Github\Client::setHttpClient方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::setHttpClient方法的具体用法?PHP Client::setHttpClient怎么用?PHP Client::setHttpClient使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Github\Client的用法示例。


在下文中一共展示了Client::setHttpClient方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getMockBadReleaseslApi

 protected function getMockBadReleaseslApi($method = 'post')
 {
     $httpClientMock = $this->getMock('Guzzle\\Http\\Client', array('send'));
     $httpClientMock->expects($this->any())->method('send');
     $mock = $this->getMock('Github\\HttpClient\\HttpClient', array(), array(array(), $httpClientMock));
     $client = new Github\Client($mock);
     $client->setHttpClient($mock);
     // Mock the Issue API.
     $repoMock = $this->getMockBuilder('Github\\Api\\Repo')->setMethods(array('releases'))->setConstructorArgs(array($client))->getMock();
     // Mock the label API.
     $releasesMock = $this->getMockBuilder('Github\\Api\\Repository\\Releases')->setMethods(array('all', 'show', 'showTag', 'create', 'edit', 'remove', 'assets'))->setConstructorArgs(array($client))->getMock();
     $releasesMock->method('showTag')->will($this->throwException(new \Exception()));
     // This actually runs an assert and makes sure our API call actually returns that :-O.
     $repoMock->method($method)->will($this->returnValue('Success'));
     // Set up the Issue API to return the Label api.
     $repoMock->expects($this->exactly(1))->method('releases')->willReturn($releasesMock);
     return $repoMock;
 }
开发者ID:rabellamy,项目名称:flo,代码行数:18,代码来源:PullRequestTestHelper.php

示例2: getGithubClient

 /**
  * Return or generate github client on-demand
  *
  * @param OutputInterface $output
  * @return GithubClient
  */
 protected function getGithubClient(OutputInterface $output)
 {
     if ($this->githubClient) {
         return $this->githubClient;
     }
     // Create authenticated github client
     $token = $this->getOAUTHToken($output);
     $client = new GithubClient();
     $httpClient = GuzzleClient::createWithConfig(['http_errors' => false]);
     $client->setHttpClient($httpClient);
     $client->authenticate($token, null, GithubClient::AUTH_HTTP_TOKEN);
     // Cache
     $this->githubClient = $client;
     return $client;
 }
开发者ID:silverstripe,项目名称:cow,代码行数:21,代码来源:PublishRelease.php

示例3: getClientMock

 protected function getClientMock(HttpClientInterface $httpClient = null)
 {
     // if no httpClient isset use the default HttpClient mock
     if (!$httpClient) {
         $httpClient = $this->getHttpClientMock();
     }
     $client = new \Github\Client($httpClient);
     $client->setHttpClient($httpClient);
     return $client;
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:10,代码来源:ResultPagerTest.php


注:本文中的Github\Client::setHttpClient方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。