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


PHP Client::method方法代码示例

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


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

示例1: testSendPostRequestWorksWithoutLogger

 public function testSendPostRequestWorksWithoutLogger()
 {
     $this->loggerMock = null;
     $this->httpClientMock->method('createRequest')->willReturn(new \GuzzleHttp\Message\Request('POST', 'someUrl'));
     $this->httpClientMock->method('send')->willReturn($this->createFutureResponse(200, '{"someData":8}'));
     $requestMaker = $this->createRequestMaker();
     $requestMaker->sendPostRequest('somerUrl');
     $this->assertTrue(true);
 }
开发者ID:pepakriz,项目名称:zbozi-api-php-library,代码行数:9,代码来源:RequestMakerTest.php

示例2: prepareGuzzleMockResponse

 /**
  * Prepares guzzle to respond to a method with a specific mocked response
  *
  * @param string $path          relative path, excluding base url
  * @param mixed  $response
  * @param string $method        POST/GET/etc
  * @param int    $statusCode
  * @param string $reasonPhrase
  */
 protected function prepareGuzzleMockResponse($path, $response, $method = 'POST', $statusCode = 200, $reasonPhrase = 'OK')
 {
     $responseMock = $this->getMockBuilder(Response::class)->getMock();
     $responseBodyMock = $this->getMockBuilder(StreamInterface::class)->getMock();
     $responseBodyMock->method('getContents')->willReturn(json_encode($response));
     $responseMock->method('getStatusCode')->willReturn($statusCode);
     $responseMock->method('getReasonPhrase')->willReturn($reasonPhrase);
     $responseMock->method('getHeaders')->willReturn([]);
     $responseMock->method('getBody')->willReturn($responseBodyMock);
     $this->guzzleMock->method('request')->with($method, rtrim(static::BASE_API_URL, '/') . '/' . $path)->willReturn($responseMock);
 }
开发者ID:czim,项目名称:van-domburg-api-client,代码行数:20,代码来源:ApiClientTest.php

示例3: testOptions

 public function testOptions()
 {
     $this->guzzleClient->method('options')->willReturn(new Response(1337));
     $this->assertEquals(1337, $this->client->options('http://localhost/', [])->getStatusCode());
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:5,代码来源:ClientTest.php


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