summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-01-13 04:35:28 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-01-13 04:35:28 +0000
commitac581679b00ec8baa4f9a94ad90af050de870efd (patch)
tree2d341b93e79bda8938d30e0d38673f90b99c28c2
parent90b08f2bd880e036d16186925c9f11b3629a37a0 (diff)
downloadbrdo-ac581679b00ec8baa4f9a94ad90af050de870efd.tar.gz
brdo-ac581679b00ec8baa4f9a94ad90af050de870efd.tar.bz2
#681940 by chx: Fixed Multistep node forms cant change the basic options. (with tests)
-rw-r--r--modules/node/node.pages.inc5
-rw-r--r--modules/node/node.test36
2 files changed, 40 insertions, 1 deletions
diff --git a/modules/node/node.pages.inc b/modules/node/node.pages.inc
index ebc40b4dc..77b45f76b 100644
--- a/modules/node/node.pages.inc
+++ b/modules/node/node.pages.inc
@@ -86,7 +86,10 @@ function node_object_prepare($node) {
// If this is a new node, fill in the default values.
if (!isset($node->nid)) {
foreach (array('status', 'promote', 'sticky') as $key) {
- $node->$key = (int) in_array($key, $node_options);
+ // Multistep node forms might have filled in something already.
+ if (!isset($node->$key)) {
+ $node->$key = (int) in_array($key, $node_options);
+ }
}
global $user;
$node->uid = $user->uid;
diff --git a/modules/node/node.test b/modules/node/node.test
index 4cd0a4859..c9f4fbd76 100644
--- a/modules/node/node.test
+++ b/modules/node/node.test
@@ -1276,3 +1276,39 @@ class NodeBlockFunctionalTest extends DrupalWebTestCase {
$this->assertText($node4->title, t('Node found in block.'));
}
}
+/**
+ * Test multistep node forms basic options.
+ */
+class MultiStepNodeFormBasicOptionsTest extends DrupalWebTestCase {
+ public static function getInfo() {
+ return array(
+ 'name' => 'Multistep node form basic options',
+ 'description' => 'Test the persistence of basic options through multiple steps.',
+ 'group' => 'Node',
+ );
+ }
+
+ function setUp() {
+ parent::setUp('poll');
+ $web_user = $this->drupalCreateUser(array('administer nodes', 'create poll content'));
+ $this->drupalLogin($web_user);
+ }
+
+ /**
+ * Change the default values of basic options to ensure they persist.
+ */
+ function testMultiStepNodeFormBasicOptions() {
+ $edit = array(
+ 'title' => 'a',
+ 'status' => FALSE,
+ 'promote' => FALSE,
+ 'sticky' => 1,
+ 'choice[new:0][chtext]' => 'a',
+ 'choice[new:1][chtext]' => 'a',
+ );
+ $this->drupalPost('node/add/poll', $edit, t('More choices'));
+ $this->assertNoFieldChecked('edit-status', 'status stayed unchecked');
+ $this->assertNoFieldChecked('edit-promote', 'promote stayed unchecked');
+ $this->assertFieldChecked('edit-sticky', 'sticky stayed checked');
+ }
+}