public function SalesforceAdminSettingsTest::testOauthCallback in Salesforce Suite 8.3
Test that the oauth mechanism appropriately sends a redirect header.
File
- src/
Tests/ SalesforceAdminSettingsTest.php, line 83
Class
- SalesforceAdminSettingsTest
- Tests for salesforce admin settings.
Namespace
Drupal\salesforce\TestsCode
public function testOauthCallback() {
$this
->drupalLogin($this->adminSalesforceUser);
$code = $this
->randomMachineName();
// Prevent redirects, and do HEAD only, otherwise we're catching errors. If
// the oauth callback gets as far as issuing a redirect, then we've
// succeeded as far as this test is concerned.
$this->maximumRedirects = 0;
$this
->drupalHead('salesforce/oauth_callback', [
'query' => [
'code' => $code,
],
]);
// Confirm that oauth_callback redirected properly. Note that base_url can
// vary wildly between test environments. Rather than parse this into
// components, we presume that presence of the expected path fulfills our
// test expectations.
$this
->assertTrue(strstr($this
->drupalGetHeader('location'), 'admin/config/salesforce/authorize'));
}