public function RestClientTest::testSimpleApiCall in Salesforce Suite 8.4
Same name and namespace in other branches
- 8.3 tests/src/Unit/RestClientTest.php \Drupal\Tests\salesforce\Unit\RestClientTest::testSimpleApiCall()
- 5.0.x tests/src/Unit/RestClientTest.php \Drupal\Tests\salesforce\Unit\RestClientTest::testSimpleApiCall()
@covers ::apiCall
File
- tests/
src/ Unit/ RestClientTest.php, line 121
Class
- RestClientTest
- @coversDefaultClass \Drupal\salesforce\Rest\RestClient @group salesforce
Namespace
Drupal\Tests\salesforce\UnitCode
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);
}