function SendgridIntegrationTestCase::testSendGridIntegrationAPISetup in SendGrid Integration 7
Same name and namespace in other branches
- 8.2 tests/sendgrid_integration.test \SendgridIntegrationTestCase::testSendGridIntegrationAPISetup()
- 8 tests/sendgrid_integration.test \SendgridIntegrationTestCase::testSendGridIntegrationAPISetup()
Set API key settings.
File
- tests/
sendgrid_integration.test, line 65 - Contains tests for the Sendgrid Integration module.
Class
- SendgridIntegrationTestCase
- Test case.
Code
function testSendGridIntegrationAPISetup() {
// Add API information.
$edit = [];
$secret = '12314512312asdfqewr1234qerqafd';
$edit['sendgrid_integration_apikey'] = $secret;
$this
->drupalPost('admin/config/services/sendgrid', $edit, t('Save Settings'));
$this
->assertText(t('SendGrid Settings Saved'), t('SendGrid API Settings Saved.'));
variable_del('sendgrid_integration_apikey');
// Attempt to add API information but no secret key.
$edit = [];
$this
->drupalPost('admin/config/services/sendgrid', $edit, t('Save Settings'));
$this
->assertText(t('API Secret Key field is required.'), t('SendGrid API Settings Rejected save without secret key.'));
}