protected function HttpStreamWrapperTest::prepareClient in Remote Stream Wrapper 8
Prepare the mock HTTP requests and responses.
Parameters
$url:
$head_response:
$get_response:
Return value
1 call to HttpStreamWrapperTest::prepareClient()
- HttpStreamWrapperTest::testStat in tests/src/ Kernel/ HttpStreamWrapperTest.php 
- @covers ::stream_stat @dataProvider dataStat
File
- tests/src/ Kernel/ HttpStreamWrapperTest.php, line 119 
Class
- HttpStreamWrapperTest
- @coversDefaultClass \Drupal\remote_stream_wrapper\StreamWrapper\HttpStreamWrapper @group remote_stream_wrapper
Namespace
Drupal\Tests\remote_stream_wrapper\KernelCode
protected function prepareClient($url, $head_response, $get_response) {
  $client = $this
    ->prophesize('\\GuzzleHttp\\Client');
  if ($head_response instanceof Response) {
    $client
      ->request('HEAD', $url, [])
      ->willReturn($head_response);
  }
  elseif ($head_response instanceof \Exception) {
    $client
      ->request('HEAD', $url, [])
      ->willThrow($head_response);
  }
  if ($get_response instanceof Response) {
    $client
      ->request('GET', $url, [])
      ->willReturn($get_response);
  }
  elseif ($get_response instanceof \Exception) {
    $client
      ->request('GET', $url, [])
      ->willThrow($get_response);
  }
  return $client
    ->reveal();
}