Index: modules/simpletest/drupal_web_test_case.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_web_test_case.php,v
retrieving revision 1.238
diff -u -p -r1.238 drupal_web_test_case.php
--- modules/simpletest/drupal_web_test_case.php	28 Sep 2010 03:30:37 -0000	1.238
+++ modules/simpletest/drupal_web_test_case.php	30 Sep 2010 02:22:46 -0000
@@ -912,6 +912,32 @@ class DrupalWebTestCase extends DrupalTe
   }
 
   /**
+   * Creates a default configuration from the testing installation profile.
+   *
+   * @param $module
+   *   The name of a module, for which a corresponding _testing_install_MODULE
+   *   function exists in the testing installation profile. For example, pass
+   *   "node" to invoke the corresponding function _testing_install_node().
+   *   The corresponding function must exist in testing.install.
+   *   Note that some default configurations depend on other, and potential
+   *   dependencies have to be created manually; e.g., pass "node" before "rdf".
+   *
+   * @see standard.install
+   */
+  protected function drupalCreateTestConfiguration($module) {
+    require_once DRUPAL_ROOT . '/' . drupal_get_path('profile', 'testing') . '/testing.install';
+    $function = '_testing_install_' . $module;
+    $function();
+
+    // Update the menu router information.
+    menu_rebuild();
+    // Reset permissions to catch any new.
+    $this->checkPermissions(array(), TRUE);
+
+    $this->pass(t('Created test configuration for %module.', array('%module' => $module)));
+  }
+
+  /**
    * Get a list files that can be used in tests.
    *
    * @param $type
@@ -982,16 +1008,18 @@ class DrupalWebTestCase extends DrupalTe
   }
 
   /**
-   * Create a user with a given set of permissions. The permissions correspond to the
-   * names given on the privileges page.
+   * Create a user with a given set of permissions.
    *
    * @param $permissions
-   *   Array of permission names to assign to user.
+   *   Array of permission names to assign to the user. Note that the user
+   *   always has the default permissions derived from the
+   *   "authenticated users" role.
+   *
    * @return
    *   A fully loaded user object with pass_raw property, or FALSE if account
    *   creation fails.
    */
-  protected function drupalCreateUser($permissions = array('access comments', 'access content', 'post comments', 'post comments without approval')) {
+  protected function drupalCreateUser(array $permissions = array()) {
     // Create a role with the given permission set.
     if (!($rid = $this->drupalCreateRole($permissions))) {
       return FALSE;
Index: modules/simpletest/tests/actions.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/actions.test,v
retrieving revision 1.18
diff -u -p -r1.18 actions.test
--- modules/simpletest/tests/actions.test	5 Aug 2010 23:53:38 -0000	1.18
+++ modules/simpletest/tests/actions.test	26 Sep 2010 16:04:23 -0000
@@ -68,10 +68,12 @@ class ActionsConfigurationTestCase exten
  * Test actions executing in a potential loop, and make sure they abort properly.
  */
 class ActionLoopTestCase extends DrupalWebTestCase {
+  protected $profile = 'testing';
+
   public static function getInfo() {
     return array(
-      'name' => 'Actions executing in a potentially infinite loop',
-      'description' => 'Tests actions executing in a loop, and makes sure they abort properly.',
+      'name' => 'Actions infinite loop',
+      'description' => 'Tests actions executing in an infinite loop, and makes sure they abort properly.',
       'group' => 'Actions',
     );
   }
Index: modules/simpletest/tests/form.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/form.test,v
retrieving revision 1.68
diff -u -p -r1.68 form.test
--- modules/simpletest/tests/form.test	24 Sep 2010 21:36:22 -0000	1.68
+++ modules/simpletest/tests/form.test	26 Sep 2010 16:19:39 -0000
@@ -7,6 +7,7 @@
  */
 
 class FormsTestCase extends DrupalWebTestCase {
+  protected $profile = 'testing';
 
   public static function getInfo() {
     return array(
@@ -17,7 +18,8 @@ class FormsTestCase extends DrupalWebTes
   }
 
   function setUp() {
-    parent::setUp('form_test');
+    parent::setUp('form_test', 'file');
+    $this->drupalCreateTestConfiguration('filter');
   }
 
   /**
@@ -370,6 +372,8 @@ class FormsTestCase extends DrupalWebTes
  * Test form alter hooks.
  */
 class FormAlterTestCase extends DrupalWebTestCase {
+  protected $profile = 'testing';
+
   public static function getInfo() {
     return array(
       'name' => 'Form alter hooks',
@@ -379,7 +383,7 @@ class FormAlterTestCase extends DrupalWe
   }
 
   function setUp() {
-    parent::setUp('form_test');
+    parent::setUp('form_test', 'block');
   }
 
   /**
@@ -404,6 +408,8 @@ class FormAlterTestCase extends DrupalWe
  * Test form validation handlers.
  */
 class FormValidationTestCase extends DrupalWebTestCase {
+  protected $profile = 'testing';
+
   public static function getInfo() {
     return array(
       'name' => 'Form validation handlers',
@@ -484,6 +490,7 @@ class FormValidationTestCase extends Dru
  * Test form element labels, required markers and associated output.
  */
 class FormsElementsLabelsTestCase extends DrupalWebTestCase {
+  protected $profile = 'testing';
 
   public static function getInfo() {
     return array(
@@ -557,6 +564,7 @@ class FormsElementsLabelsTestCase extend
  * Test the tableselect form element for expected behavior.
  */
 class FormsElementsTableSelectFunctionalTest extends DrupalWebTestCase {
+  protected $profile = 'testing';
 
   public static function getInfo() {
     return array(
@@ -764,6 +772,7 @@ class FormsElementsTableSelectFunctional
  * values aren't lost due to a wrong form rebuild.
  */
 class FormsFormStorageTestCase extends DrupalWebTestCase {
+  protected $profile = 'testing';
 
   public static function getInfo() {
     return array(
@@ -914,6 +923,8 @@ class FormsFormStorageTestCase extends D
  * Test wrapper form callbacks.
  */
 class FormsFormWrapperTestCase extends DrupalWebTestCase {
+  protected $profile = 'testing';
+
   public static function getInfo() {
     return array(
       'name' => 'Form wrapper callback',
@@ -940,6 +951,8 @@ class FormsFormWrapperTestCase extends D
  * Test $form_state clearance.
  */
 class FormStateValuesCleanTestCase extends DrupalWebTestCase {
+  protected $profile = 'testing';
+
   public static function getInfo() {
     return array(
       'name' => 'Form state values clearance',
@@ -1082,6 +1095,7 @@ class FormsRebuildTestCase extends Drupa
  * Test the programmatic form submission behavior.
  */
 class FormsProgrammaticTestCase extends DrupalWebTestCase {
+  protected $profile = 'testing';
 
   public static function getInfo() {
     return array(
@@ -1162,6 +1176,7 @@ class FormsProgrammaticTestCase extends 
  * Test that FAPI correctly determines $form_state['triggering_element'].
  */
 class FormsTriggeringElementTestCase extends DrupalWebTestCase {
+  protected $profile = 'testing';
 
   public static function getInfo() {
     return array(
@@ -1326,6 +1341,7 @@ class FormsArbitraryRebuildTestCase exte
  * Tests form API file inclusion.
  */
 class FormsFileInclusionTestCase extends DrupalWebTestCase {
+  protected $profile = 'testing';
 
   public static function getInfo() {
     return array(
@@ -1340,17 +1356,14 @@ class FormsFileInclusionTestCase extends
   }
 
   /**
-   * Tests loading an include specified in hook_menu().
+   * Tests form state file inclusion.
    */
   function testLoadMenuInclude() {
+    // Verify loading an include specified in hook_menu().
     $this->drupalPostAJAX('form-test/load-include-menu', array(), array('op' => t('Save')), 'system/ajax', array(), array(), 'form-test-load-include-menu');
     $this->assertText('Submit callback called.');
-  }
 
-  /**
-   * Tests loading a custom specified inlcude.
-   */
-  function testLoadCustomInclude() {
+    // Verify loading a custom specified include.
     $this->drupalPost('form-test/load-include-custom', array(), t('Save'));
     $this->assertText('Submit callback called.');
   }
Index: profiles/testing/testing.install
===================================================================
RCS file: /cvs/drupal/drupal/profiles/testing/testing.install,v
retrieving revision 1.2
diff -u -p -r1.2 testing.install
--- profiles/testing/testing.install	27 Aug 2010 12:36:53 -0000	1.2
+++ profiles/testing/testing.install	30 Sep 2010 02:20:46 -0000
@@ -14,3 +14,455 @@ function testing_install() {
   user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access content'));
   user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access content'));
 }
+
+/**
+ * Configures default text formats.
+ */
+function _testing_install_filter() {
+  $filtered_html_format = array(
+    'name' => 'Filtered HTML',
+    'weight' => 0,
+    'filters' => array(
+      // URL filter.
+      'filter_url' => array(
+        'weight' => 0,
+        'status' => 1,
+      ),
+      // HTML filter.
+      'filter_html' => array(
+        'weight' => 1,
+        'status' => 1,
+      ),
+      // Line break filter.
+      'filter_autop' => array(
+        'weight' => 2,
+        'status' => 1,
+      ),
+      // HTML corrector filter.
+      'filter_htmlcorrector' => array(
+        'weight' => 10,
+        'status' => 1,
+      ),
+    ),
+  );
+  $filtered_html_format = (object) $filtered_html_format;
+  filter_format_save($filtered_html_format);
+
+  $full_html_format = array(
+    'name' => 'Full HTML',
+    'weight' => 1,
+    'filters' => array(
+      // URL filter.
+      'filter_url' => array(
+        'weight' => 0,
+        'status' => 1,
+      ),
+      // Line break filter.
+      'filter_autop' => array(
+        'weight' => 1,
+        'status' => 1,
+      ),
+      // HTML corrector filter.
+      'filter_htmlcorrector' => array(
+        'weight' => 10,
+        'status' => 1,
+      ),
+    ),
+  );
+  $full_html_format = (object) $full_html_format;
+  filter_format_save($full_html_format);
+
+  // Grant default permissions.
+  $filtered_html_permission = filter_permission_name($filtered_html_format);
+  user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array($filtered_html_permission));
+  user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array($filtered_html_permission));
+}
+
+/**
+ * Configures default blocks.
+ */
+function _testing_install_block() {
+  $default_theme = variable_get('theme_default', 'bartik');
+  $admin_theme = 'seven';
+  $values = array(
+    array(
+      'module' => 'system',
+      'delta' => 'main',
+      'theme' => $default_theme,
+      'status' => 1,
+      'weight' => 0,
+      'region' => 'content',
+      'pages' => '',
+      'cache' => -1,
+    ),
+    array(
+      'module' => 'search',
+      'delta' => 'form',
+      'theme' => $default_theme,
+      'status' => 1,
+      'weight' => -1,
+      'region' => 'sidebar_first',
+      'pages' => '',
+      'cache' => -1,
+    ),
+    array(
+      'module' => 'node',
+      'delta' => 'recent',
+      'theme' => $admin_theme,
+      'status' => 1,
+      'weight' => 10,
+      'region' => 'dashboard_main',
+      'pages' => '',
+      'cache' => -1,
+    ),
+    array(
+      'module' => 'user',
+      'delta' => 'login',
+      'theme' => $default_theme,
+      'status' => 1,
+      'weight' => 0,
+      'region' => 'sidebar_first',
+      'pages' => '',
+      'cache' => -1,
+    ),
+    array(
+      'module' => 'system',
+      'delta' => 'navigation',
+      'theme' => $default_theme,
+      'status' => 1,
+      'weight' => 0,
+      'region' => 'sidebar_first',
+      'pages' => '',
+      'cache' => -1,
+    ),
+    array(
+      'module' => 'system',
+      'delta' => 'management',
+      'theme' => $default_theme,
+      'status' => 1,
+      'weight' => 1,
+      'region' => 'sidebar_first',
+      'pages' => '',
+      'cache' => -1,
+    ),
+    array(
+      'module' => 'system',
+      'delta' => 'powered-by',
+      'theme' => $default_theme,
+      'status' => 1,
+      'weight' => 10,
+      'region' => 'footer',
+      'pages' => '',
+      'cache' => -1,
+    ),
+    array(
+      'module' => 'system',
+      'delta' => 'help',
+      'theme' => $default_theme,
+      'status' => 1,
+      'weight' => 0,
+      'region' => 'help',
+      'pages' => '',
+      'cache' => -1,
+    ),
+    array(
+      'module' => 'system',
+      'delta' => 'main',
+      'theme' => $admin_theme,
+      'status' => 1,
+      'weight' => 0,
+      'region' => 'content',
+      'pages' => '',
+      'cache' => -1,
+    ),
+    array(
+      'module' => 'system',
+      'delta' => 'help',
+      'theme' => $admin_theme,
+      'status' => 1,
+      'weight' => 0,
+      'region' => 'help',
+      'pages' => '',
+      'cache' => -1,
+    ),
+    array(
+      'module' => 'user',
+      'delta' => 'login',
+      'theme' => $admin_theme,
+      'status' => 1,
+      'weight' => 10,
+      'region' => 'content',
+      'pages' => '',
+      'cache' => -1,
+    ),
+    array(
+      'module' => 'user',
+      'delta' => 'new',
+      'theme' => $admin_theme,
+      'status' => 1,
+      'weight' => 0,
+      'region' => 'dashboard_sidebar',
+      'pages' => '',
+      'cache' => -1,
+    ),
+    array(
+      'module' => 'search',
+      'delta' => 'form',
+      'theme' => $admin_theme,
+      'status' => 1,
+      'weight' => -10,
+      'region' => 'dashboard_sidebar',
+      'pages' => '',
+      'cache' => -1,
+    ),
+  );
+  $query = db_insert('block')
+    ->fields(array('module', 'delta', 'theme', 'status', 'weight', 'region', 'pages', 'cache'));
+  foreach ($values as $record) {
+    $query->values($record);
+  }
+  $query->execute();
+}
+
+/**
+ * Confgures default node types.
+ */
+function _testing_install_node() {
+  // For a complete list of available node type attributes, refer to the node
+  // type API documentation.
+  // @see http://api.drupal.org/api/HEAD/function/hook_node_info
+  $types = array(
+    array(
+      'type' => 'page',
+      'name' => st('Basic page'),
+      'base' => 'node_content',
+      'description' => st("Use <em>basic pages</em> for your static content, such as an 'About us' page."),
+      'custom' => 1,
+      'modified' => 1,
+      'locked' => 0,
+    ),
+    array(
+      'type' => 'article',
+      'name' => st('Article'),
+      'base' => 'node_content',
+      'description' => st('Use <em>articles</em> for time-sensitive content like news, press releases or blog posts.'),
+      'custom' => 1,
+      'modified' => 1,
+      'locked' => 0,
+    ),
+  );
+  foreach ($types as $type) {
+    $type = node_type_set_defaults($type);
+    node_type_save($type);
+    node_add_body_field($type);
+  }
+
+  // Default "Basic page" to not be promoted and do not display date and author
+  // information for it.
+  variable_set('node_options_page', array('status'));
+  variable_set('node_submitted_page', FALSE);
+
+  // Grant default permissions.
+  user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access content'));
+  user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access content'));
+}
+
+/**
+ * Configures default RDF mappings.
+ */
+function _testing_install_rdf() {
+  $rdf_mappings = array(
+    array(
+      'type' => 'node',
+      'bundle' => 'page',
+      'mapping' => array(
+        'rdftype' => array('foaf:Document'),
+      ),
+    ),
+    array(
+      'type' => 'node',
+      'bundle' => 'article',
+      'mapping' => array(
+        'rdftype' => array('sioc:Item', 'foaf:Document'),
+        'field_image' => array(
+          'predicates' => array('og:image', 'rdfs:seeAlso'),
+          'type' => 'rel',
+        ),
+        'field_tags' => array(
+          'predicates' => array('dc:subject'),
+          'type' => 'rel',
+        ),
+      ),
+    ),
+  );
+  foreach ($rdf_mappings as $rdf_mapping) {
+    rdf_mapping_save($rdf_mapping);
+  }
+}
+
+/**
+ * Configures default comment settings.
+ */
+function _testing_install_comment() {
+  // Default "Basic page" to have comments disabled.
+  variable_set('comment_page', COMMENT_NODE_HIDDEN);
+
+  // Grant default permissions.
+  user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access comments'));
+  user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access comments', 'post comments', 'post comments without approval'));
+}
+
+/**
+ * Configures default user settings.
+ */
+function _testing_install_user() {
+  // Enable user picture support and set the default to a square thumbnail option.
+  variable_set('user_pictures', '1');
+  variable_set('user_picture_dimensions', '1024x1024');
+  variable_set('user_picture_file_size', '800');
+  variable_set('user_picture_style', 'thumbnail');
+
+  // Allow visitor account creation with administrative approval.
+  variable_set('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL);
+
+  // Create a default role for site administrators, with all available
+  // permissions assigned.
+  $admin_role = new stdClass();
+  $admin_role->name = 'administrator';
+  $admin_role->weight = 2;
+  user_role_save($admin_role);
+  user_role_grant_permissions($admin_role->rid, array_keys(module_invoke_all('permission')));
+
+  // Set this as the administrator role.
+  variable_set('user_admin_role', $admin_role->rid);
+
+  // Assign user 1 the "administrator" role.
+  db_insert('users_roles')
+    ->fields(array('uid' => 1, 'rid' => $admin_role->rid))
+    ->execute();
+}
+
+/**
+ * Configures default taxonomy vocabularies and fields.
+ */
+function _testing_install_taxonomy() {
+  $description = st('Use tags to group articles on similar topics into categories.');
+  $help = st('Enter a comma-separated list of words to describe your content.');
+  $vocabulary = (object) array(
+    'name' => 'Tags',
+    'description' => $description,
+    'machine_name' => 'tags',
+    'help' => $help,
+
+  );
+  taxonomy_vocabulary_save($vocabulary);
+
+  $field = array(
+    'field_name' => 'field_' . $vocabulary->machine_name,
+    'type' => 'taxonomy_term_reference',
+    // Set cardinality to unlimited for tagging.
+    'cardinality' => FIELD_CARDINALITY_UNLIMITED,
+    'settings' => array(
+      'allowed_values' => array(
+        array(
+          'vid' => $vocabulary->vid,
+          'parent' => 0,
+        ),
+      ),
+    ),
+  );
+  field_create_field($field);
+
+  $instance = array(
+    'field_name' => 'field_' . $vocabulary->machine_name,
+    'entity_type' => 'node',
+    'label' => $vocabulary->name,
+    'bundle' => 'article',
+    'description' => $vocabulary->help,
+    'widget' => array(
+      'type' => 'taxonomy_autocomplete',
+      'weight' => -4,
+    ),
+    'display' => array(
+      'default' => array(
+        'type' => 'taxonomy_term_reference_link',
+        'weight' => 10,
+      ),
+      'teaser' => array(
+        'type' => 'taxonomy_term_reference_link',
+        'weight' => 10,
+      ),
+    ),
+  );
+  field_create_instance($instance);
+}
+
+/**
+ * Configures default image fields.
+ */
+function _testing_install_image() {
+  // Many of the following values will be defaulted, they're included here as
+  // illustrative examples.
+  // @see http://api.drupal.org/api/function/field_create_field/7
+  $field = array(
+    'field_name' => 'field_image',
+    'type' => 'image',
+    'cardinality' => 1,
+    'translatable' => TRUE,
+    'locked' => FALSE,
+    'indexes' => array('fid' => array('fid')),
+    'settings' => array(
+      'uri_scheme' => 'public',
+      'default_image' => FALSE,
+    ),
+    'storage' => array(
+      'type' => 'field_sql_storage',
+      'settings' => array(),
+    ),
+  );
+  field_create_field($field);
+
+  // Many of the following values will be defaulted, they're included here as
+  // illustrative examples.
+  // @see http://api.drupal.org/api/function/field_create_instance/7
+  $instance = array(
+    'field_name' => 'field_image',
+    'entity_type' => 'node',
+    'label' => 'Image',
+    'bundle' => 'article',
+    'description' => st('Upload an image to go with this article.'),
+    'required' => FALSE,
+    'settings' => array(
+      'file_directory' => 'field/image',
+      'file_extensions' => 'png gif jpg jpeg',
+      'max_filesize' => '',
+      'max_resolution' => '',
+      'min_resolution' => '',
+      'alt_field' => TRUE,
+      'title_field' => '',
+    ),
+    'widget' => array(
+      'type' => 'image_image',
+      'settings' => array(
+        'progress_indicator' => 'throbber',
+        'preview_image_style' => 'thumbnail',
+      ),
+      'weight' => -1,
+    ),
+    'display' => array(
+      'default' => array(
+        'label' => 'hidden',
+        'type' => 'image',
+        'settings' => array('image_style' => 'large', 'image_link' => ''),
+        'weight' => -1,
+      ),
+      'teaser' => array(
+        'label' => 'hidden',
+        'type' => 'image',
+        'settings' => array('image_style' => 'medium', 'image_link' => 'content'),
+        'weight' => -1,
+      ),
+    ),
+  );
+  field_create_instance($instance);
+}
