public function RestClientTest::testReauthApiCall in Salesforce Suite 8.4
Same name and namespace in other branches
- 8.3 tests/src/Unit/RestClientTest.php \Drupal\Tests\salesforce\Unit\RestClientTest::testReauthApiCall()
- 5.0.x tests/src/Unit/RestClientTest.php \Drupal\Tests\salesforce\Unit\RestClientTest::testReauthApiCall()
@covers ::apiCall
File
- tests/
src/ Unit/ RestClientTest.php, line 156
Class
- RestClientTest
- @coversDefaultClass \Drupal\salesforce\Rest\RestClient @group salesforce
Namespace
Drupal\Tests\salesforce\UnitCode
public function testReauthApiCall() {
$this
->initClient();
// Test that apiCall does auto-re-auth after 401 response.
$response_401 = new GuzzleResponse(401);
$response_200 = new GuzzleResponse(200);
// @TODO this is extremely brittle, exposes complexity in underlying client. Refactor this.
$this->client
->expects($this
->at(0))
->method('httpRequest')
->willReturn($response_401);
$this->client
->expects($this
->at(1))
->method('httpRequest')
->willReturn($response_200);
$this->client
->apiCall('');
}