You are here

public function ConfigurationCtoolsWebTestCase::testViewsOverridden in Configuration Management 7

Tests that views configurations that are marked as overriden are reverted properly.

File

tests/configuration.ctools.test, line 72
Test cases for contrib modules supported by configuration.

Class

ConfigurationCtoolsWebTestCase
Configuration test case for ctools.

Code

public function testViewsOverridden() {
  $this
    ->trackViewsConfigurations();

  // Test frontpage view overrides.
  // Edit the view and change the title.
  $new_title = $this
    ->randomName(16);
  $edit = array(
    'title' => $new_title,
  );
  $this
    ->drupalPost('admin/structure/views/nojs/display/frontpage/page/title', $edit, t('Apply'));
  $this
    ->drupalPost('admin/structure/views/view/frontpage/edit/page', array(), t('Save'));

  // @todo remove this line once we have a observer for ctools components.
  $this
    ->drupalPost('admin/config/system/configuration/settings', array(), t('Check for new configurations'));
  $this
    ->assertRaw($this->configuration_needs_saving_text, t('Activestore overriden message is present'));
  $status = configuration_get_status('views_view', 'frontpage');
  $this
    ->assertEqual($status, CONFIGURATION_ACTIVESTORE_OVERRIDDEN, t('frontpage view component status overridden'));

  // Test frontpage view back to default.
  $edit = array(
    'title' => '',
  );
  $this
    ->drupalPost('admin/structure/views/nojs/display/frontpage/page/title', $edit, t('Apply'));
  $this
    ->drupalPost('admin/structure/views/view/frontpage/edit/page', array(), t('Save'));

  // @todo remove this line once we have a observer for ctools components.
  $this
    ->drupalPost('admin/config/system/configuration/settings', array(), t('Check for new configurations'));
  $this
    ->assertNoRaw($this->configuration_needs_saving_text, t('Activestore overriden message is not present'));
  $status = configuration_get_status('views_view', 'frontpage');
  $this
    ->assertEqual($status, CONFIGURATION_IN_SYNC, t('frontpage view component status in sync'));
}