You are here

public function RestClientTest::testExceptionApiCall in Salesforce Suite 8.3

Same name and namespace in other branches
  1. 8.4 tests/src/Unit/RestClientTest.php \Drupal\Tests\salesforce\Unit\RestClientTest::testExceptionApiCall()
  2. 5.0.x tests/src/Unit/RestClientTest.php \Drupal\Tests\salesforce\Unit\RestClientTest::testExceptionApiCall()

@covers ::apiCall @expectedException Exception

File

tests/src/Unit/RestClientTest.php, line 132

Class

RestClientTest
@coversDefaultClass \Drupal\salesforce\Rest\RestClient @group salesforce

Namespace

Drupal\Tests\salesforce\Unit

Code

public function testExceptionApiCall() {
  $this
    ->initClient();

  // Test that SF client throws an exception for non-200 response.
  $response = new GuzzleResponse(456);
  $this->client
    ->expects($this
    ->any())
    ->method('httpRequest')
    ->willReturn($response);
  $this->client
    ->apiCall('');
}