You are here

public function RestClientTest::testSimpleApiCall 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::testSimpleApiCall()
  2. 5.0.x tests/src/Unit/RestClientTest.php \Drupal\Tests\salesforce\Unit\RestClientTest::testSimpleApiCall()

@covers ::apiCall

File

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

Class

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

Namespace

Drupal\Tests\salesforce\Unit

Code

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

  // Test that an apiCall returns a json-decoded value.
  $body = [
    'foo' => 'bar',
  ];
  $response = new GuzzleResponse(200, [], json_encode($body));
  $this->client
    ->expects($this
    ->any())
    ->method('httpRequest')
    ->willReturn($response);
  $result = $this->client
    ->apiCall('');
  $this
    ->assertEquals($result, $body);
}