You are here

public function ConfigurationWebTestCase::trackConfigurations in Configuration Management 7

Track Configurations.

10 calls to ConfigurationWebTestCase::trackConfigurations()
ConfigurationActiveStoreOverriddenTest::testImportDatastoreToActivestore in tests/configuration.test
Tests that configurations that are marked as overriden are reverted properly.
ConfigurationActiveStoreOverriddenTest::testOverridden in tests/configuration.test
Tests that configurations get marked as overriden.
ConfigurationCtoolsWebTestCase::trackViewsConfigurations in tests/configuration.ctools.test
Tests tracking configurations for the views module.
ConfigurationTrackingTest::testTracking in tests/configuration.test
Tests that configurations get tracked.
ConfigurationUITest::testDisableMessages in tests/configuration.test
Tests the disable messages functionality.

... See full list

File

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

Class

ConfigurationWebTestCase
Base class for functional tests for configuration management.

Code

public function trackConfigurations($components = NULL, $filenames = array()) {
  $roles = user_roles();
  if ($components == NULL) {
    $this->trackedComponents = array(
      'filter' => array(
        'filtered_html',
      ),
      'field' => array(
        'node-' . $this->type->type . '-body',
      ),
      'node' => array(
        $this->type->type,
      ),
      'image' => array(
        'large',
      ),
      'taxonomy' => array(
        $this->vocab->machine_name,
      ),
      'user_permission' => array(
        'access configuration management',
      ),
      'user_role' => array(
        $roles[3],
      ),
    );
  }
  else {
    $this->trackedComponents = $components;
  }
  $edit = array();
  foreach ($this->trackedComponents as $component => $identifiers) {
    foreach ($identifiers as $identifier) {

      // Don't check the checkbox for fields, it is automatically tracked
      // when the content type is tracked.
      //
      // @TODO: This is a bug, fix this.
      if ($component != 'field') {
        $edit[$component . '[items][' . $identifier . ']'] = 1;
      }
    }
  }
  $this->tracked = $edit;
  $this
    ->drupalPost('admin/config/system/configuration/notracking', $edit, t('Write to Datastore'));

  // After start traking configurations, a file should be created by each
  // component.
  $types = array(
    'field',
    'image',
    'node',
    'filter',
    'user_permission',
    'user_role',
    'taxonomy',
  );

  // Check created files.
  if (empty($filenames)) {

    // Generate a default filename array based on component names.
    foreach ($types as $type) {
      $filenames[] = 'configuration.' . $type . '.inc';
    }
  }
  foreach ($filenames as $filename) {
    $config_file_exists = file_exists($this->datastore_path . '/' . $filename);
    $this
      ->assertTrue($config_file_exists, "Configuration file {$filename} was created.");
  }
  $this
    ->assertResponse(200);
}