You are here

public function SettingsFormTest::testSetSettings in Node Option Premium 8

Tests changing configuration.

File

tests/src/Functional/Form/SettingsFormTest.php, line 63

Class

SettingsFormTest
Tests configuring the module.

Namespace

Drupal\Tests\nopremium\Functional\Form

Code

public function testSetSettings() {
  $this
    ->drupalLogin($this->adminUser);

  // Change some config.
  $edit = [
    'default_message' => 'This is premium content.',
    'view_modes[full]' => 'full',
    'view_modes[rss]' => 'rss',
    'view_modes[teaser]' => '',
    'teaser_view_mode' => 'rss',
  ];
  $this
    ->drupalPostForm('/admin/config/content/nopremium', $edit, 'Save configuration');
  $expected = [
    'default_message' => 'This is premium content.',
    'view_modes' => [
      'full' => 'full',
      'rss' => 'rss',
    ],
    'teaser_view_mode' => 'rss',
  ];
  $config = $this
    ->config('nopremium.settings')
    ->getRawData();
  unset($config['_core']);
  $this
    ->assertSame($expected, $config);
}