diff options
author | webchick <webchick@24967.no-reply.drupal.org> | 2011-08-22 03:45:06 +0100 |
---|---|---|
committer | webchick <webchick@24967.no-reply.drupal.org> | 2011-08-22 03:45:06 +0100 |
commit | f6227eea35cbf12b0023c5b57f4a7341403f541e (patch) | |
tree | e1302c52b4bff6aebbfd59adf6f42a0f20efaa65 /modules/poll | |
parent | 317e0ff6c7d8b1c0b09e8e6edd23ddff914497cf (diff) | |
download | brdo-f6227eea35cbf12b0023c5b57f4a7341403f541e.tar.gz brdo-f6227eea35cbf12b0023c5b57f4a7341403f541e.tar.bz2 |
Issue #1244784 by marcingy: Fixed Add another answer in edit poll, not saved.
Diffstat (limited to 'modules/poll')
-rw-r--r-- | modules/poll/poll.module | 5 | ||||
-rw-r--r-- | modules/poll/poll.test | 21 |
2 files changed, 24 insertions, 2 deletions
diff --git a/modules/poll/poll.module b/modules/poll/poll.module index 861969573..01c6bcc80 100644 --- a/modules/poll/poll.module +++ b/modules/poll/poll.module @@ -583,7 +583,10 @@ function poll_update($node) { 'chvotes' => (int) $choice['chvotes'], 'weight' => $choice['weight'], )) - ->insertFields(array('nid' => $node->nid)) + ->insertFields(array( + 'nid' => $node->nid, + 'chtext' => $choice['chtext'], + )) ->execute(); } else { diff --git a/modules/poll/poll.test b/modules/poll/poll.test index 6fabf9567..d6c4f4005 100644 --- a/modules/poll/poll.test +++ b/modules/poll/poll.test @@ -188,7 +188,7 @@ class PollCreateTestCase extends PollTestCase { function testPollCreate() { $title = $this->randomName(); $choices = $this->_generateChoices(7); - $this->pollCreate($title, $choices, TRUE); + $poll_nid = $this->pollCreate($title, $choices, TRUE); // Verify poll appears on 'poll' page. $this->drupalGet('poll'); @@ -198,6 +198,25 @@ class PollCreateTestCase extends PollTestCase { // Click on the poll title to go to node page. $this->clickLink($title); $this->assertText('Total votes: 0', 'Link to poll correct.'); + + // Now add a new option to make sure that when we update the node the + // option is displayed. + $node = node_load($poll_nid); + + $new_option = $this->randomName(); + + $node->choice[] = array( + 'chid' => '', + 'chtext' => $new_option, + 'chvotes' => 0, + 'weight' => 0, + ); + + node_save($node); + + $this->drupalGet('poll'); + $this->clickLink($title); + $this->assertText($new_option, 'New option found.'); } function testPollClose() { |