You are here

public function ConfigurationUITest::testDisableMessages in Configuration Management 7

Tests the disable messages functionality.

File

tests/configuration.test, line 636
Tests for Configuration Management

Class

ConfigurationUITest

Code

public function testDisableMessages() {
  $this
    ->trackConfigurations();

  // Expeting message after modify a tracked component.
  $edit = array();
  $edit["filters[filter_url][settings][filter_url_length]"] = 20;
  $this
    ->drupalPost('admin/config/content/formats/filtered_html', $edit, t('Save configuration'));
  $this
    ->drupalGet('admin');
  $this
    ->assertRaw($this->configuration_needs_saving_text, t('Warning message displayed'));

  // Messages are only displayed in admin/* paths.
  $this
    ->drupalGet('node');
  $this
    ->assertNoRaw($this->configuration_needs_saving_text, t('Warning message displayed'));

  // Disable the messages.
  $edit = array();
  $edit["configuration_display_messages"] = FALSE;
  $this
    ->drupalPost('admin/config/system/configuration/settings', $edit, t('Save configuration'));

  // Now no message should be displayed.
  $this
    ->drupalGet('admin');
  $this
    ->assertNoRaw($this->configuration_needs_saving_text, t('No warning message displayed'));

  // Enable again the messages.
  $edit = array();
  $edit["configuration_display_messages"] = TRUE;
  $this
    ->drupalPost('admin/config/system/configuration/settings', $edit, t('Save configuration'));

  // Check if messages are displayed again.
  $this
    ->drupalGet('admin');
  $this
    ->assertRaw($this->configuration_needs_saving_text, t('Warning message displayed'));
}