You are here

public function MailchimpAdminSettingsFormTest::testSettingsForm in Mailchimp 8

Same name and namespace in other branches
  1. 2.x tests/src/Functional/MailchimpAdminSettingsFormTest.php \Drupal\Tests\mailchimp\Functional\MailchimpAdminSettingsFormTest::testSettingsForm()

Tests the basic behavior of the settings form.

File

tests/src/Functional/MailchimpAdminSettingsFormTest.php, line 20

Class

MailchimpAdminSettingsFormTest
Tests the Mailchimp settings form.

Namespace

Drupal\Tests\mailchimp\Functional

Code

public function testSettingsForm() {
  $this
    ->drupalLogin($this->lowUser);
  $this
    ->drupalGet('/admin/config/services/mailchimp');
  $this
    ->assertResponse(403);
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->drupalGet('/admin/config/services/mailchimp');
  $this
    ->assertResponse(200);
  $this
    ->submitForm([
    'api_key' => 'TEST_KEY',
  ], 'Save configuration');
  $this
    ->assertText('The configuration options have been saved');
  $this
    ->assertEquals('TEST_KEY', \Drupal::config('mailchimp.settings')
    ->get('api_key'));
}