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


PHP ClientInterface::shouldReceive方法代码示例

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


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

示例1: testCreatingMessageBatch

 public function testCreatingMessageBatch()
 {
     $this->guzzle->shouldReceive('createRequest')->twice()->andReturn($this->request);
     $requests = $this->client->batch(function ($pusher) {
         $pusher->send(new Message('recipient', 'text'));
         $pusher->send(new Message('recipient', 'text'));
     });
     $this->assertCount(2, $requests);
 }
开发者ID:vdbf,项目名称:pushover-php,代码行数:9,代码来源:ClientTest.php

示例2: it_should_pass_no_partition_when_no_partition_available

 /**
  * @test
  * @covers ::query
  */
 public function it_should_pass_no_partition_when_no_partition_available()
 {
     $response = m::mock(Response::class);
     $this->httpClient->shouldReceive('request')->withArgs(['GET', '127.0.0.1/projection/name'])->andReturn($response);
     $result = json_encode(['data' => 'projectionData']);
     $response->shouldReceive('getStatusCode')->andReturn('200');
     $response->shouldReceive('getBody')->andReturn($result);
     $proxy = EventStoreProxy::forUrl('127.0.0.1', $this->httpClient);
     $this->assertSame(['data' => 'projectionData'], $proxy->query('name'));
 }
开发者ID:php-in-practice,项目名称:matters-projections,代码行数:14,代码来源:EventStoreProxyTest.php

示例3: testErrorInResponseThrowsException

 public function testErrorInResponseThrowsException()
 {
     $text = 'Hello, World!';
     $response = m::mock(ResponseInterface::class);
     $this->guzzle->shouldReceive('request')->once()->with('GET', 'https://www.googleapis.com/language/translate/v2', ['query' => ['key' => config('translation.clients.api_key'), 'format' => 'html', 'source' => 'en', 'target' => 'es', 'q' => $text]])->andReturn($response);
     $response->shouldReceive('getBody')->andReturn(json_encode(['error' => 'foo']));
     $this->client->setSource('en');
     $this->client->setTarget('es');
     $this->setExpectedException(\ErrorException::class);
     $this->client->translate($text);
 }
开发者ID:stevebauman,项目名称:translation,代码行数:11,代码来源:GoogleTranslateApiTest.php

示例4: setUp

 public function setUp()
 {
     $this->client = Mockery::mock(ClientInterface::class);
     $this->getConfigMethod = $this->client->shouldReceive('getConfig')->withArgs(['base_uri'])->once()->andReturnNull()->byDefault();
     $this->sendMethod = $this->client->shouldReceive('send')->with(\Mockery::type(Request::class))->byDefault();
 }
开发者ID:link0,项目名称:phpebble,代码行数:6,代码来源:GuzzleTimelineTest.php

示例5: thenConnectionIsChecked

 /**
  * Verifies whether the send method is invoked once, meaning that the connection is checked.
  */
 private function thenConnectionIsChecked()
 {
     $this->httpClient->shouldReceive('send')->once();
 }
开发者ID:php-in-practice,项目名称:matters-projections,代码行数:7,代码来源:EventStoreProjectionsDriverTest.php


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