summaryrefslogtreecommitdiff
path: root/modules/node
diff options
context:
space:
mode:
Diffstat (limited to 'modules/node')
-rw-r--r--modules/node/node.test50
1 files changed, 50 insertions, 0 deletions
diff --git a/modules/node/node.test b/modules/node/node.test
index f9af7e4cd..f1c296a76 100644
--- a/modules/node/node.test
+++ b/modules/node/node.test
@@ -857,6 +857,56 @@ class NodeTypeTestCase extends DrupalWebTestCase {
$this->drupalGet('node/add/' . str_replace('_', '-', $type->name));
$this->assertResponse(200, 'The new content type can be accessed at node/add.');
}
+
+ /**
+ * Test editing a node type using the UI.
+ */
+ function testNodeTypeEditing() {
+ $web_user = $this->drupalCreateUser(array('bypass node access', 'administer content types'));
+ $this->drupalLogin($web_user);
+
+ $instance = field_info_instance('body', 'page');
+ $this->assertEqual($instance['label'], 'Body', t('Body field was found.'));
+
+ // Verify that title and body fields are displayed.
+ $this->drupalGet('node/add/page');
+ $this->assertRaw('Title', t('Title field was found.'));
+ $this->assertRaw('Full text', t('Body field was found.'));
+
+ // Rename the title field and remove the body field.
+ $edit = array(
+ 'title_label' => 'Foo',
+ 'body_label' => '',
+ );
+ $this->drupalPost('admin/structure/types/manage/page', $edit, t('Save content type'));
+ field_info_cache_clear();
+
+ $this->assertFalse(field_info_instance('body', 'page'), t('Body field was removed.'));
+ $this->drupalGet('node/add/page');
+ $this->assertRaw('Foo', t('New title label was displayed.'));
+ $this->assertNoRaw('Title', t('Old title label was not displayed.'));
+ $this->assertNoRaw('Full text', t('Body field was not found.'));
+
+ // Add the body field again and change the name, machine name and description.
+ $edit = array(
+ 'name' => 'Bar',
+ 'type' => 'bar',
+ 'description' => 'Lorem ipsum.',
+ 'body_label' => 'Baz',
+ );
+ $this->drupalPost('admin/structure/types/manage/page', $edit, t('Save content type'));
+ field_info_cache_clear();
+
+ $instance = field_info_instance('body', 'bar');
+ $this->assertEqual($instance['label'], 'Baz', t('Body field was added.'));
+ $this->drupalGet('node/add');
+ $this->assertRaw('Bar', t('New name was displayed.'));
+ $this->assertRaw('Lorem ipsum', t('New description was displayed.'));
+ $this->clickLink('Bar');
+ $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('Full text', t('Body field was found.'));
+ }
}
/**