commit 89f227506a1ae197eb8292bc3eb4ede1c2125960
Author: GDrupal <GDrupal@1161294.no-reply.drupal.org>
Date:   Fri Aug 10 18:10:32 2012 -0300

    Issue #1671404: Import files wrapper, drush command and test cases.

diff --git a/configuration.admin.inc b/configuration.admin.inc
index 3439335..9cb235a 100644
--- a/configuration.admin.inc
+++ b/configuration.admin.inc
@@ -445,7 +445,6 @@ function configuration_import_form_submit($form, &$form_state) {
 
   $validators = array('file_validate_extensions' => array('tar'));
   if ($file = file_save_upload('import_configurations', $validators, $path)) {
-    // dpm($file);
     $archive = archiver_get_archiver($file->uri);
     $files = $archive->listContents();
     foreach ($files as $filename) {
@@ -453,55 +452,17 @@ function configuration_import_form_submit($form, &$form_state) {
         file_unmanaged_delete($path . '/' . $filename);
       }
     }
-
+    // Decompress the tar file.
     $archive->extract($path);
 
-    if (!is_file($path . "/configuration/config.export")) {
-      drupal_set_message(t('Could not find config.export file in Import'), 'error');
-      return;
-    }
-
-    $config_migrate = drupal_parse_info_file($path . "/configuration/config.export");
-    $components = configuration_get_components();
-    foreach ($config_migrate['config'] as $component => $info) {
-      if (!array_key_exists($component, $components)) continue;
-
-      if (!array_key_exists('default_file', $components[$component])) {
-        $config_info['configuration.inc'][$component] = $components[$component];
-      }
-      elseif ($components[$component]['default_file'] == CONFIGURATION_DEFAULTS_INCLUDED) {
-        $config_info['configuration.' . $component . '.inc'][$component] = $components[$component];
-      }
-      elseif ($components[$component]['default_file'] == CONFIGURATION_DEFAULTS_CUSTOM) {
-        $config_info[$components[$component]['default_filename'] . '.inc'][$component] = $components[$component];
-      }
-    }
+    // Import configuration files into activestore.
+    $reverted = configuration_import_files(drupal_realpath($path) .'/configuration/');
 
-    $revert = array();
-    foreach (file_scan_directory($path, '/.*inc$/') as $config_file) {
-      if (in_array($config_file->filename, array_keys($config_info))) {
-        // Rewrite function signatures in the migrate files to allow the
-        // ability to load migrate files and restore
-        $content = file_get_contents($path . '/configuration/' . $config_file->filename);
-        $content = preg_replace('/function configuration_/', 'function migrate_configuration_', $content);
-        file_put_contents($path . '/configuration/' . $config_file->filename, $content);
-
-        // Load the migrate file
-        include_once $path . '/configuration/' . $config_file->filename;
-        $revert_files[] = $config_file->filename;
-      }
-    }
-    foreach ($revert_files as $migrate_file) {
-      foreach ($config_info[$migrate_file] as $component => $info) {
-        $revert[$component] = array('#import_all' => TRUE);
-      }
-    }
-
-    configuration_revert($revert, 'migrate_configuration');
-
-    // Delete the uploaded file
+    // Delete the uploaded file.
     file_delete($file);
-    drupal_set_message(t('Migrated %component configurations to the activestore', array('%component' => join(', ', array_keys($revert)))));
+    if ($reverted) {
+      drupal_set_message(t('Migrated %component configurations to the activestore', array('%component' => join(', ', array_keys($reverted)))));
+    }
   }
 }
 
diff --git a/configuration.drush.inc b/configuration.drush.inc
new file mode 100644
index 0000000..61fb3b6
--- /dev/null
+++ b/configuration.drush.inc
@@ -0,0 +1,69 @@
+<?php
+
+/**
+ * @file
+ * configuration.drush.inc
+ * Let you perform configuration actions from the console.
+ */
+
+/**
+ * Implements of hook_drush_help()
+ */
+function configuration_drush_help($section) {
+  switch ($section) {
+    case 'drush:cimp':
+      return dt("Import external configuration files in the specified directory
+                directly to the activestore.");
+  }
+}
+
+/**
+ * Implements of hook_drush_command().
+ */
+function configuration_drush_command() {
+  $items = array();
+  $items['config-import'] = array(
+    'callback' => '_configuration_import_files',
+    'description' => 'Import external configuration files in the specified
+                      directory directly to the activestore',
+    'aliases' => array('cimp'),
+    'examples' => array(
+      'drush cimp /home/configuration/' => 'Import configuration files within
+      the /home/configuration/ directory',
+    ),
+    'arguments' => array(
+      'path' => 'Path to a folder containing all configuration files.',
+    ),
+  );
+  return $items;
+}
+
+/**
+ * Import configurations into activestore.
+ */
+function _configuration_import_files($path = '') {
+  /**
+   * @todo
+   * Add support for tar files as well as directories.
+   */
+  if (empty($path)) {
+    return drush_set_error(dt('Directory path argument required.'));
+  }
+
+  $msg = dt('You are about to overwrite local configuration. Are you sure you want to Proceed? (DO NOT USE THIS ON A PRODUCTION SITE)');
+  $proceed = drush_confirm($msg);
+
+  if ($proceed) {
+    //Import configuration files into activestore.
+    $reverted = configuration_import_files($path);
+    if (is_array($reverted)) {
+      $output = dt('Migrated @component configurations to the activestore.',
+              array('@component' => join(', ', array_keys($reverted))));
+      drush_log($output, 'success');
+    }
+    else {
+      $output = dt('No configurations were migrated.');
+      drush_log($output, 'error');
+    }
+  }
+}
diff --git a/configuration.module b/configuration.module
index f250cd9..f34f8d4 100644
--- a/configuration.module
+++ b/configuration.module
@@ -252,8 +252,12 @@ function configuration_stream_wrappers() {
  * Implements hook_init().
  */
 function configuration_init() {
-  // Don't create messages on intermediate submit handler pages.
-  if (arg(0) == 'admin' && variable_get('configuration_display_messages', TRUE) && empty($_POST)) {
+  global $conf;
+  /**
+   * Don't create messages on intermediate submit handler pages, content pages
+   * and during the install process.
+   */
+  if (arg(0) == 'admin' && variable_get('configuration_display_messages', TRUE) && empty($_POST) && !empty($conf['install_task']) && $conf['install_task'] == 'done') {
     $overridden = configuration_get_configuration('overridden');
     if (user_access('access configuration management') && $overridden !== 0) {
       if ($overridden | (CONFIGURATION_ACTIVESTORE_OVERRIDDEN | CONFIGURATION_DATASTORE_OVERRIDDEN)) {
@@ -1140,3 +1144,81 @@ function configuration_update_component_status($component, $identifier, $items,
 foreach (file_scan_directory(drupal_get_path('module', 'configuration') . '/observers', '/.*/') as $filename) {
   require $filename->uri;
 }
+
+/**
+ * Import external configuration files in the specified directory directly to
+ * the activestore.
+ */
+function configuration_import_files($path = '') {
+
+  if (!is_file($path . "config.export")) {
+    drupal_set_message(t('Could not find config.export file.'), 'error');
+    return FALSE;
+  }
+
+  //If the directory it is not writable copy all file to a writable location.
+  if (!file_prepare_directory($path, FILE_MODIFY_PERMISSIONS)) {
+    $path .= "/";
+    // A temp directory to work on.
+    $dest_directory = file_directory_temp() . '/' . rand() . '/';
+    if (!file_prepare_directory($dest_directory, FILE_MODIFY_PERMISSIONS | FILE_CREATE_DIRECTORY)) {
+      drupal_set_message(t('"@d" non-writeable directory. Unable to create a temporary directory in "@t" to finish the proccess.', array('@d' => drupal_realpath($path), '@t' => drupal_realpath($dest_directory))), 'error');
+      return FALSE;
+    }
+    $dest_directory .= "/";
+    drupal_set_message(t('"@d" non-writeable directory. Files were copied to a temporary location to finish the proccess.', array('@d' => drupal_realpath($path))), 'status');
+    file_unmanaged_copy($path . "config.export", $dest_directory . "config.export");
+    foreach (file_scan_directory($path, '/.*inc$/') as $config_file) {
+      file_unmanaged_copy($path . $config_file->filename, $dest_directory . '/' . $config_file->filename);
+    }
+    $path = $dest_directory;
+  }
+  else {
+    $path .= "/";
+  }
+
+  $config_migrate = drupal_parse_info_file($path . "config.export");
+  $components = configuration_get_components();
+  foreach ($config_migrate['config'] as $component => $info) {
+    if (!array_key_exists($component, $components))
+      continue;
+
+    if (!array_key_exists('default_file', $components[$component])) {
+      $config_info['configuration.inc'][$component] = $components[$component];
+    }
+    elseif ($components[$component]['default_file'] == CONFIGURATION_DEFAULTS_INCLUDED) {
+      $config_info['configuration.' . $component . '.inc'][$component] = $components[$component];
+    }
+    elseif ($components[$component]['default_file'] == CONFIGURATION_DEFAULTS_CUSTOM) {
+      $config_info[$components[$component]['default_filename'] . '.inc'][$component] = $components[$component];
+    }
+  }
+
+  $revert = array();
+  foreach (file_scan_directory($path, '/.*inc$/') as $config_file) {
+    if (in_array($config_file->filename, array_keys($config_info))) {
+      // Rewrite function signatures in the migrate files to allow the
+      // ability to load migrate files and restore
+      $content = file_get_contents($path . $config_file->filename);
+      $content = preg_replace('/function configuration_/', 'function migrate_configuration_', $content);
+      file_put_contents($path . $config_file->filename, $content);
+
+      // Load the external file.
+      include_once $path . $config_file->filename;
+      $revert_files[] = $config_file->filename;
+    }
+  }
+  foreach ($revert_files as $migrate_file) {
+    foreach ($config_info[$migrate_file] as $component => $info) {
+      $revert[$component] = array('#import_all' => TRUE);
+    }
+  }
+  if (count($revert) == 0) {
+    drupal_set_message(t('Could not find component files to revert.'), 'error');
+    return FALSE;
+  }
+  configuration_revert($revert, 'migrate_configuration');
+  //Clean up the temporary directory
+  file_unmanaged_delete_recursive($path);
+  return $revert;
+}
diff --git a/tests/configuration.test b/tests/configuration.test
index 315a875..3663ad9 100644
--- a/tests/configuration.test
+++ b/tests/configuration.test
@@ -138,7 +138,8 @@ class ConfigurationWebTestCase extends DrupalWebTestCase {
           'administer permissions',
           'administer users',
           'administer image styles',
-          'administer taxonomy'
+          'administer taxonomy',
+          'administer menu',
         );
       }
 
@@ -431,8 +432,49 @@ class ConfigurationActiveStoreOverriddenTest extends ConfigurationWebTestCase {
     // Make sure that image styles were reverted properly
     $this->drupalGet('admin/config/media/image-styles');
     $this->assertNoRaw(t('revert'), t('No overriden image styles'));
-
   }
+
+   /**
+   * Tests that configurations are imported properly from files.
+   */
+//  public function testImportFilesToActivestore() {
+//    $result = configuration_import_files(drupal_realpath(drupal_get_path('module', 'configuration')) . '/tests/import_files/');
+//    $this->assertTrue($result, t('Import proccess finished correctly'));
+//
+//    // Text format component.
+//    $this->drupalGet('admin/config/content/formats');
+//    $this->assertRaw('Configuration Test Format', 'Configuration text format was imported.');
+//
+//    // Menu and menu-links components.
+//    $this->drupalGet('admin/structure/menu');
+//    $this->assertRaw('Configuration Test Menu', 'Configuration menu was imported.');
+//    $this->drupalGet('admin/structure/menu/manage/menu-configuration-test-menu');
+//    $this->assertRaw('Edit Configuration Test Content Type', 'Configuration menu item 1 was imported.');
+//    $this->assertRaw('Edit Configuration Test Field', 'Configuration menu item 2 was imported.');
+//    $this->assertRaw('Edit Configuration Test Format', 'Configuration menu item 3 was imported.');
+//
+//    // Taxonomy component.
+//    $this->drupalGet('admin/structure/taxonomy');
+//    $this->assertRaw('Configuration Test Vocabulary', 'Configuration vocabulary was imported.');
+//
+//    // Role component.
+//    $this->drupalGet('admin/people/permissions/roles');
+//    $this->assertRaw('configuration test user', 'Configuration vocabulary was imported.');
+//
+//    // Content type component.
+//    $this->drupalGet('admin/structure/types');
+//    $this->assertRaw('Configuration Test Content type', 'Configuration content type was imported.');
+//
+//    // Field component.
+//    $this->drupalGet('admin/structure/types/manage/configuration-test-content-type/fields');
+//    $this->assertRaw('Configuration test field', 'Configuration term reference field was imported.');
+//    $this->assertRaw('Configuration Test Image', 'Configuration image field was imported.');
+//
+//    // Image style component.
+//    $this->drupalGet('admin/config/media/image-styles');
+//    $this->assertRaw('configuration_test_style', 'Configuration image style was imported.');
+//  }
+
 }
 
 class ConfigurationUITest extends ConfigurationWebTestCase {
diff --git a/tests/import_files/config.export b/tests/import_files/config.export
new file mode 100644
index 0000000..085a0ff
--- /dev/null
+++ b/tests/import_files/config.export
@@ -0,0 +1,29 @@
+config[filter][configuration_test_format][status] = 0
+config[filter][configuration_test_format][hash] = '7ba03958f725f9e5debe99afe2e9412e'
+config[filter][configuration_test_format][parent] = ''
+config[image][configuration_test_style][status] = 0
+config[image][configuration_test_style][hash] = '8661c3cb93641fe2093542bf26d289c5'
+config[image][configuration_test_style][parent] = ''
+config[menu_links][menu-configuration-test-menu:admin/structure/types/manage/configuration-test-content-type][status] = 0
+config[menu_links][menu-configuration-test-menu:admin/structure/types/manage/configuration-test-content-type][hash] = '148b6535a7bc8d492767bb24f9808c58'
+config[menu_links][menu-configuration-test-menu:admin/structure/types/manage/configuration-test-content-type][parent] = ''
+config[menu_links][menu-configuration-test-menu:admin/structure/types/manage/configuration-test-content-type/fields/field_configuration_test_field][status] = 0
+config[menu_links][menu-configuration-test-menu:admin/structure/types/manage/configuration-test-content-type/fields/field_configuration_test_field][hash] = '153263d37851fb6a1db5bee5070155a4'
+config[menu_links][menu-configuration-test-menu:admin/structure/types/manage/configuration-test-content-type/fields/field_configuration_test_field][parent] = ''
+config[menu_links][menu-configuration-test-menu:admin/config/content/formats/configuration_test_format][status] = 0
+config[menu_links][menu-configuration-test-menu:admin/config/content/formats/configuration_test_format][hash] = '4838f7df4656d116731373bd69cddd8f'
+config[menu_links][menu-configuration-test-menu:admin/config/content/formats/configuration_test_format][parent] = ''
+config[node][configuration_test_content_type][status] = 0
+config[node][configuration_test_content_type][hash] = '9c6176f3caa902819d8c530af90c5fd7'
+config[node][configuration_test_content_type][parent] = ''
+config[user_role][configuration test user][status] = 0
+config[user_role][configuration test user][hash] = '15e35d2f68fc86d7a0bdc59aaf9849ae'
+config[user_role][configuration test user][parent] = ''
+config[field][node-configuration_test_content_type-body][status] = 8
+config[field][node-configuration_test_content_type-body][parent] = 'configuration_test_content_type'
+config[field][node-configuration_test_content_type-field_configuration_test_field][status] = 8
+config[field][node-configuration_test_content_type-field_configuration_test_field][parent] = 'configuration_test_content_type'
+config[field][node-configuration_test_content_type-field_configuration_test_image][status] = 8
+config[field][node-configuration_test_content_type-field_configuration_test_image][parent] = 'configuration_test_content_type'
+config[taxonomy][configuration_test_vocabulary][status] = 8
+config[taxonomy][configuration_test_vocabulary][parent] = 'node-configuration_test_content_type-field_configuration_test_field'
diff --git a/tests/import_files/configuration.field.inc b/tests/import_files/configuration.field.inc
new file mode 100644
index 0000000..e455098
--- /dev/null
+++ b/tests/import_files/configuration.field.inc
@@ -0,0 +1,246 @@
+<?php
+/**
+ * @file
+ * configuration.field.inc
+ */
+
+/**
+ * Implements hook_field_default_fields().
+ */
+function configuration_field_default_fields() {
+  $fields = array();
+
+  // Exported field: 'node-configuration_test_content_type-body'
+  $fields['node-configuration_test_content_type-body'] = array(
+    'field_config' => array(
+      'active' => 1,
+      'cardinality' => 1,
+      'deleted' => 0,
+      'entity_types' => array(
+        0 => 'node',
+      ),
+      'field_name' => 'body',
+      'foreign keys' => array(
+        'format' => array(
+          'columns' => array(
+            'format' => 'format',
+          ),
+          'table' => 'filter_format',
+        ),
+      ),
+      'indexes' => array(
+        'format' => array(
+          0 => 'format',
+        ),
+      ),
+      'module' => 'text',
+      'settings' => array(),
+      'translatable' => 0,
+      'type' => 'text_with_summary',
+    ),
+    'field_instance' => array(
+      'bundle' => 'configuration_test_content_type',
+      'default_value' => NULL,
+      'deleted' => 0,
+      'description' => '',
+      'display' => array(
+        'default' => array(
+          'label' => 'hidden',
+          'module' => 'text',
+          'settings' => array(),
+          'type' => 'text_default',
+          'weight' => 0,
+        ),
+        'teaser' => array(
+          'label' => 'hidden',
+          'module' => 'text',
+          'settings' => array(
+            'trim_length' => 600,
+          ),
+          'type' => 'text_summary_or_trimmed',
+          'weight' => 0,
+        ),
+      ),
+      'entity_type' => 'node',
+      'field_name' => 'body',
+      'label' => 'Body',
+      'required' => 0,
+      'settings' => array(
+        'display_summary' => 1,
+        'text_processing' => 1,
+        'user_register_form' => 0,
+      ),
+      'widget' => array(
+        'active' => 1,
+        'module' => 'text',
+        'settings' => array(
+          'rows' => 20,
+          'summary_rows' => 5,
+        ),
+        'type' => 'text_textarea_with_summary',
+        'weight' => -4,
+      ),
+    ),
+  );
+
+  // Exported field: 'node-configuration_test_content_type-field_configuration_test_field'
+  $fields['node-configuration_test_content_type-field_configuration_test_field'] = array(
+    'field_config' => array(
+      'active' => 1,
+      'cardinality' => 1,
+      'deleted' => 0,
+      'entity_types' => array(),
+      'field_name' => 'field_configuration_test_field',
+      'foreign keys' => array(
+        'tid' => array(
+          'columns' => array(
+            'tid' => 'tid',
+          ),
+          'table' => 'taxonomy_term_data',
+        ),
+      ),
+      'indexes' => array(
+        'tid' => array(
+          0 => 'tid',
+        ),
+      ),
+      'module' => 'taxonomy',
+      'settings' => array(
+        'allowed_values' => array(
+          0 => array(
+            'vocabulary' => 'configuration_test_vocabulary',
+            'parent' => 0,
+          ),
+        ),
+      ),
+      'translatable' => 0,
+      'type' => 'taxonomy_term_reference',
+    ),
+    'field_instance' => array(
+      'bundle' => 'configuration_test_content_type',
+      'default_value' => array(
+        0 => array(
+          'tid' => 2,
+        ),
+      ),
+      'deleted' => 0,
+      'description' => '',
+      'display' => array(
+        'default' => array(
+          'label' => 'above',
+          'module' => 'taxonomy',
+          'settings' => array(),
+          'type' => 'taxonomy_term_reference_link',
+          'weight' => 1,
+        ),
+        'teaser' => array(
+          'label' => 'above',
+          'settings' => array(),
+          'type' => 'hidden',
+          'weight' => 0,
+        ),
+      ),
+      'entity_type' => 'node',
+      'field_name' => 'field_configuration_test_field',
+      'label' => 'Configuration test field',
+      'required' => 0,
+      'settings' => array(
+        'user_register_form' => 0,
+      ),
+      'widget' => array(
+        'active' => 1,
+        'module' => 'options',
+        'settings' => array(),
+        'type' => 'options_buttons',
+        'weight' => -3,
+      ),
+    ),
+  );
+
+  // Exported field: 'node-configuration_test_content_type-field_configuration_test_image'
+  $fields['node-configuration_test_content_type-field_configuration_test_image'] = array(
+    'field_config' => array(
+      'active' => 1,
+      'cardinality' => 1,
+      'deleted' => 0,
+      'entity_types' => array(),
+      'field_name' => 'field_configuration_test_image',
+      'foreign keys' => array(
+        'fid' => array(
+          'columns' => array(
+            'fid' => 'fid',
+          ),
+          'table' => 'file_managed',
+        ),
+      ),
+      'indexes' => array(
+        'fid' => array(
+          0 => 'fid',
+        ),
+      ),
+      'module' => 'image',
+      'settings' => array(
+        'default_image' => 0,
+        'uri_scheme' => 'public',
+      ),
+      'translatable' => 0,
+      'type' => 'image',
+    ),
+    'field_instance' => array(
+      'bundle' => 'configuration_test_content_type',
+      'deleted' => 0,
+      'description' => '',
+      'display' => array(
+        'default' => array(
+          'label' => 'above',
+          'module' => 'image',
+          'settings' => array(
+            'image_link' => '',
+            'image_style' => '',
+          ),
+          'type' => 'image',
+          'weight' => 2,
+        ),
+        'teaser' => array(
+          'label' => 'above',
+          'settings' => array(),
+          'type' => 'hidden',
+          'weight' => 0,
+        ),
+      ),
+      'entity_type' => 'node',
+      'field_name' => 'field_configuration_test_image',
+      'label' => 'Configuration Test Image',
+      'required' => 0,
+      'settings' => array(
+        'alt_field' => 0,
+        'default_image' => 0,
+        'file_directory' => '',
+        'file_extensions' => 'png gif jpg jpeg',
+        'max_filesize' => '',
+        'max_resolution' => '',
+        'min_resolution' => '',
+        'title_field' => 0,
+        'user_register_form' => 0,
+      ),
+      'widget' => array(
+        'active' => 1,
+        'module' => 'image',
+        'settings' => array(
+          'preview_image_style' => 'configuration_test_style',
+          'progress_indicator' => 'throbber',
+        ),
+        'type' => 'image_image',
+        'weight' => -2,
+      ),
+    ),
+  );
+
+  // Translatables
+  // Included for use with string extractors like potx.
+  t('Body');
+  t('Configuration Test Image');
+  t('Configuration test field');
+
+  return $fields;
+}
diff --git a/tests/import_files/configuration.filter.inc b/tests/import_files/configuration.filter.inc
new file mode 100644
index 0000000..951c497
--- /dev/null
+++ b/tests/import_files/configuration.filter.inc
@@ -0,0 +1,34 @@
+<?php
+/**
+ * @file
+ * configuration.filter.inc
+ */
+
+/**
+ * Implements hook_filter_default_formats().
+ */
+function configuration_filter_default_formats() {
+  $formats = array();
+
+  // Exported format: Configuration Test Format
+  $formats['configuration_test_format'] = array(
+    'format' => 'configuration_test_format',
+    'name' => 'Configuration Test Format',
+    'cache' => 1,
+    'status' => 1,
+    'weight' => 0,
+    'filters' => array(
+      'filter_html' => array(
+        'weight' => -10,
+        'status' => 1,
+        'settings' => array(
+          'allowed_html' => '<a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>',
+          'filter_html_help' => 1,
+          'filter_html_nofollow' => 1,
+        ),
+      ),
+    ),
+  );
+
+  return $formats;
+}
diff --git a/tests/import_files/configuration.image.inc b/tests/import_files/configuration.image.inc
new file mode 100644
index 0000000..0f9b483
--- /dev/null
+++ b/tests/import_files/configuration.image.inc
@@ -0,0 +1,36 @@
+<?php
+/**
+ * @file
+ * configuration.image.inc
+ */
+
+/**
+ * Implements hook_configuration_image_default_styles().
+ */
+function configuration_configuration_image_default_styles() {
+  $styles = array();
+
+  // Exported image style: configuration_test_style
+  $styles['configuration_test_style'] = array(
+    'name' => 'configuration_test_style',
+    'effects' => array(
+      1 => array(
+        'label' => 'Scale and crop',
+        'help' => 'Scale and crop will maintain the aspect-ratio of the original image, then crop the larger dimension. This is most useful for creating perfectly square thumbnails without stretching the image.',
+        'effect callback' => 'image_scale_and_crop_effect',
+        'dimensions callback' => 'image_resize_dimensions',
+        'form callback' => 'image_resize_form',
+        'summary theme' => 'image_resize_summary',
+        'module' => 'image',
+        'name' => 'image_scale_and_crop',
+        'data' => array(
+          'width' => 100,
+          'height' => 100,
+        ),
+        'weight' => 1,
+      ),
+    ),
+  );
+
+  return $styles;
+}
diff --git a/tests/import_files/configuration.menu_custom.inc b/tests/import_files/configuration.menu_custom.inc
new file mode 100644
index 0000000..1a66403
--- /dev/null
+++ b/tests/import_files/configuration.menu_custom.inc
@@ -0,0 +1,26 @@
+<?php
+/**
+ * @file
+ * configuration.menu_custom.inc
+ */
+
+/**
+ * Implements hook_menu_default_menu_custom().
+ */
+function configuration_menu_default_menu_custom() {
+  $menus = array();
+
+  // Exported menu: menu-configuration-test-menu
+  $menus['menu-configuration-test-menu'] = array(
+    'menu_name' => 'menu-configuration-test-menu',
+    'title' => 'Configuration Test Menu',
+    'description' => 'A menu used for testing purposes.',
+  );
+  // Translatables
+  // Included for use with string extractors like potx.
+  t('A menu used for testing purposes.');
+  t('Configuration Test Menu');
+
+
+  return $menus;
+}
diff --git a/tests/import_files/configuration.menu_links.inc b/tests/import_files/configuration.menu_links.inc
new file mode 100644
index 0000000..8a197cb
--- /dev/null
+++ b/tests/import_files/configuration.menu_links.inc
@@ -0,0 +1,75 @@
+<?php
+/**
+ * @file
+ * configuration.menu_links.inc
+ */
+
+/**
+ * Implements hook_menu_default_menu_links().
+ */
+function configuration_menu_default_menu_links() {
+  $menu_links = array();
+
+  // Exported menu link: menu-configuration-test-menu:admin/config/content/formats/configuration_test_format
+  $menu_links['menu-configuration-test-menu:admin/config/content/formats/configuration_test_format'] = array(
+    'menu_name' => 'menu-configuration-test-menu',
+    'link_path' => 'admin/config/content/formats/configuration_test_format',
+    'router_path' => 'admin/config/content/formats/%',
+    'link_title' => 'Edit Configuration Test Format',
+    'options' => array(
+      'attributes' => array(
+        'title' => '',
+      ),
+    ),
+    'module' => 'menu',
+    'hidden' => 0,
+    'external' => 0,
+    'has_children' => 0,
+    'expanded' => 0,
+    'weight' => 0,
+  );
+  // Exported menu link: menu-configuration-test-menu:admin/structure/types/manage/configuration-test-content-type
+  $menu_links['menu-configuration-test-menu:admin/structure/types/manage/configuration-test-content-type'] = array(
+    'menu_name' => 'menu-configuration-test-menu',
+    'link_path' => 'admin/structure/types/manage/configuration-test-content-type',
+    'router_path' => 'admin/structure/types/manage/%',
+    'link_title' => 'Edit Configuration Test Content Type',
+    'options' => array(
+      'attributes' => array(
+        'title' => '',
+      ),
+    ),
+    'module' => 'menu',
+    'hidden' => 0,
+    'external' => 0,
+    'has_children' => 0,
+    'expanded' => 0,
+    'weight' => 0,
+  );
+  // Exported menu link: menu-configuration-test-menu:admin/structure/types/manage/configuration-test-content-type/fields/field_configuration_test_field
+  $menu_links['menu-configuration-test-menu:admin/structure/types/manage/configuration-test-content-type/fields/field_configuration_test_field'] = array(
+    'menu_name' => 'menu-configuration-test-menu',
+    'link_path' => 'admin/structure/types/manage/configuration-test-content-type/fields/field_configuration_test_field',
+    'router_path' => 'admin/structure/types/manage/%/fields/%',
+    'link_title' => 'Edit Configuration Test Field',
+    'options' => array(
+      'attributes' => array(
+        'title' => '',
+      ),
+    ),
+    'module' => 'menu',
+    'hidden' => 0,
+    'external' => 0,
+    'has_children' => 0,
+    'expanded' => 0,
+    'weight' => 0,
+  );
+  // Translatables
+  // Included for use with string extractors like potx.
+  t('Edit Configuration Test Content Type');
+  t('Edit Configuration Test Field');
+  t('Edit Configuration Test Format');
+
+
+  return $menu_links;
+}
diff --git a/tests/import_files/configuration.node.inc b/tests/import_files/configuration.node.inc
new file mode 100644
index 0000000..dc8a882
--- /dev/null
+++ b/tests/import_files/configuration.node.inc
@@ -0,0 +1,22 @@
+<?php
+/**
+ * @file
+ * configuration.node.inc
+ */
+
+/**
+ * Implements hook_configuration_node_info().
+ */
+function configuration_configuration_node_info() {
+  $items = array(
+    'configuration_test_content_type' => array(
+      'name' => t('Configuration Test Content type'),
+      'base' => 'node_content',
+      'description' => t('A content type used for testing purposes.'),
+      'has_title' => '1',
+      'title_label' => t('Title'),
+      'help' => '',
+    ),
+  );
+  return $items;
+}
diff --git a/tests/import_files/configuration.taxonomy.inc b/tests/import_files/configuration.taxonomy.inc
new file mode 100644
index 0000000..d0a31ff
--- /dev/null
+++ b/tests/import_files/configuration.taxonomy.inc
@@ -0,0 +1,36 @@
+<?php
+/**
+ * @file
+ * configuration.taxonomy.inc
+ */
+
+/**
+ * Implements hook_taxonomy_default_vocabularies().
+ */
+function configuration_taxonomy_default_vocabularies() {
+  return array(
+    'configuration_test_vocabulary' => array(
+      'name' => 'Configuration Test Vocabulary',
+      'machine_name' => 'configuration_test_vocabulary',
+      'description' => 'A test vocabulary.',
+      'hierarchy' => 0,
+      'module' => 'taxonomy',
+      'weight' => 0,
+      'rdf_mapping' => array(
+        'rdftype' => array(
+          0 => 'skos:ConceptScheme',
+        ),
+        'name' => array(
+          'predicates' => array(
+            0 => 'dc:title',
+          ),
+        ),
+        'description' => array(
+          'predicates' => array(
+            0 => 'rdfs:comment',
+          ),
+        ),
+      ),
+    ),
+  );
+}
diff --git a/tests/import_files/configuration.user_role.inc b/tests/import_files/configuration.user_role.inc
new file mode 100644
index 0000000..5e9a623
--- /dev/null
+++ b/tests/import_files/configuration.user_role.inc
@@ -0,0 +1,20 @@
+<?php
+/**
+ * @file
+ * configuration.user_role.inc
+ */
+
+/**
+ * Implements hook_user_default_roles().
+ */
+function configuration_user_default_roles() {
+  $roles = array();
+
+  // Exported role: configuration test user
+  $roles['configuration test user'] = array(
+    'name' => 'configuration test user',
+    'weight' => 3,
+  );
+
+  return $roles;
+}
