summaryrefslogtreecommitdiff
path: root/modules/node
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-01-09 16:19:56 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-01-09 16:19:56 +0000
commitcb159b9ff1b3165219292e63a89fa553d5811749 (patch)
tree3ebfbf4da01d867591855c0d3b2c81bca2b64809 /modules/node
parent3042f3385c65630a913e8ce6816bcd39526d5456 (diff)
downloadbrdo-cb159b9ff1b3165219292e63a89fa553d5811749.tar.gz
brdo-cb159b9ff1b3165219292e63a89fa553d5811749.tar.bz2
#143434 by Jody Lynn: Move 'display post information' to where users would expect.
Diffstat (limited to 'modules/node')
-rw-r--r--modules/node/content_types.inc13
-rw-r--r--modules/node/node.test62
2 files changed, 74 insertions, 1 deletions
diff --git a/modules/node/content_types.inc b/modules/node/content_types.inc
index be1dd7654..3868c50f4 100644
--- a/modules/node/content_types.inc
+++ b/modules/node/content_types.inc
@@ -159,7 +159,18 @@ function node_type_form(&$form_state, $type = NULL) {
),
'#description' => t('Users with the <em>administer nodes</em> permission will be able to override these options.'),
);
-
+ $form['display'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Display settings'),
+ '#collapsible' => TRUE,
+ '#collapsed' => TRUE,
+ );
+ $form['display']['node_submitted'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Display post information'),
+ '#default_value' => variable_get('node_submitted_'. $type->type, TRUE),
+ '#description' => t('Enable the <em>submitted by Username on date</em> text.'),
+ );
$form['old_type'] = array(
'#type' => 'value',
'#value' => $type->type,
diff --git a/modules/node/node.test b/modules/node/node.test
index 419a1dfd3..42294f721 100644
--- a/modules/node/node.test
+++ b/modules/node/node.test
@@ -537,3 +537,65 @@ class NodeBlockTestCase extends DrupalWebTestCase {
$this->assertText(t('The block settings have been updated.'), t('Block successfully move to footer region.'));
}
}
+
+/**
+ * Check that the post information displays when enabled for a content type.
+ */
+class NodePostSettingsTestCase extends DrupalWebTestCase {
+ function getInfo() {
+ return array(
+ 'name' => t('Node post information display'),
+ 'description' => t('Check that the post information (submitted by Username on date) text displays appropriately.'),
+ 'group' => t('Node'),
+ );
+ }
+
+ function setUp() {
+ parent::setUp();
+
+ $web_user = $this->drupalCreateUser(array('create page content', 'administer content types', 'access user profiles'));
+ $this->drupalLogin($web_user);
+ }
+
+ /**
+ * Set page content type to display post information and confirm its presence on a new node.
+ */
+ function testPagePostInfo() {
+
+ // Set page content type to display post information.
+ $edit = array();
+ $edit['node_submitted'] = TRUE;
+ $this->drupalPost('admin/build/node-type/page', $edit, t('Save content type'));
+
+ // Create a node.
+ $edit = array();
+ $edit['title'] = $this->randomName(8);
+ $edit['body'] = $this->randomName(16);
+ $this->drupalPost('node/add/page', $edit, t('Save'));
+
+ // Check that the post information is displayed.
+ $node = $this->drupalGetNodeByTitle($edit['title']);
+ $this->assertRaw(theme('node_submitted', $node), t('Post information is displayed.'));
+ }
+
+ /**
+ * Set page content type to not display post information and confirm its absence on a new node.
+ */
+ function testPageNotPostInfo() {
+
+ // Set page content type to display post information.
+ $edit = array();
+ $edit['node_submitted'] = FALSE;
+ $this->drupalPost('admin/build/node-type/page', $edit, t('Save content type'));
+
+ // Create a node.
+ $edit = array();
+ $edit['title'] = $this->randomName(8);
+ $edit['body'] = $this->randomName(16);
+ $this->drupalPost('node/add/page', $edit, t('Save'));
+
+ // Check that the post information is displayed.
+ $node = $this->drupalGetNodeByTitle($edit['title']);
+ $this->assertNoRaw(theme('node_submitted', $node), t('Post information is not displayed.'));
+ }
+} \ No newline at end of file