? sites/default/files
? sites/default/private
? sites/default/settings.php
Index: modules/node/content_types.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/content_types.inc,v
retrieving revision 1.114
diff -u -p -r1.114 content_types.inc
--- modules/node/content_types.inc	5 May 2010 06:55:25 -0000	1.114
+++ modules/node/content_types.inc	21 Jun 2010 15:28:38 -0000
@@ -363,13 +363,13 @@ function node_type_form_submit($form, &$
 
   node_types_rebuild();
   menu_rebuild();
-  node_add_body_field($type);
   $t_args = array('%name' => $type->name);
 
   if ($status == SAVED_UPDATED) {
     drupal_set_message(t('The content type %name has been updated.', $t_args));
   }
   elseif ($status == SAVED_NEW) {
+    node_add_body_field($type);
     drupal_set_message(t('The content type %name has been added.', $t_args));
     watchdog('node', 'Added content type %name.', $t_args, WATCHDOG_NOTICE, l(t('view'), 'admin/structure/types'));
   }
Index: modules/node/node.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.test,v
retrieving revision 1.86
diff -u -p -r1.86 node.test
--- modules/node/node.test	26 May 2010 07:52:12 -0000	1.86
+++ modules/node/node.test	21 Jun 2010 15:28:40 -0000
@@ -1056,9 +1056,10 @@ class NodeTypeTestCase extends DrupalWeb
   }
 
   /**
-   * Test creating a content type.
+   * Test creating a content type programmatically and via a form.
    */
   function testNodeTypeCreation() {
+    // Create a content type programmaticaly.
     $type = $this->drupalCreateContentType();
 
     $type_exists = db_query('SELECT 1 FROM {node_type} WHERE type = :type', array(':type' => $type->type))->fetchField();
@@ -1070,6 +1071,18 @@ class NodeTypeTestCase extends DrupalWeb
 
     $this->drupalGet('node/add/' . str_replace('_', '-', $type->name));
     $this->assertResponse(200, 'The new content type can be accessed at node/add.');
+    
+    // Create a content type via the user interface.
+    $web_user = $this->drupalCreateUser(array('bypass node access', 'administer content types'));
+    $this->drupalLogin($web_user);
+    $edit = array(
+      'name' => 'foo',
+      'title_label' => 'title for foo',
+      'type' => 'foo',
+    );
+    $this->drupalPost('admin/structure/types/add', $edit, t('Save content type'));
+    $type_exists = db_query('SELECT 1 FROM {node_type} WHERE type = :type', array(':type' => 'foo'))->fetchField();
+    $this->assertTrue($type_exists, 'The new content type has been created in the database.');
   }
 
   /**
@@ -1106,6 +1119,7 @@ class NodeTypeTestCase extends DrupalWeb
       'description' => 'Lorem ipsum.',
     );
     $this->drupalPost('admin/structure/types/manage/page', $edit, t('Save content type'));
+    field_info_cache_clear();
 
     $this->drupalGet('node/add');
     $this->assertRaw('Bar', t('New name was displayed.'));
@@ -1114,6 +1128,14 @@ class NodeTypeTestCase extends DrupalWeb
     $this->assertEqual(url('node/add/bar', array('absolute' => TRUE)), $this->getUrl(), t('New machine name was used in URL.'));
     $this->assertRaw('Foo', t('Title field was found.'));
     $this->assertRaw('Body', t('Body field was found.'));
+
+    // Remove the body field.
+    $this->drupalPost('admin/structure/types/manage/bar/fields/body/delete', NULL, t('Delete'));
+    // Resave the settings for this type.
+    $this->drupalPost('admin/structure/types/manage/bar', array(), t('Save content type'));
+    // Check that the body field doesn't exist.
+    $this->drupalGet('node/add/bar');
+    $this->assertNoRaw('Body', t('Body field was found.'));
   }
 }
 
