Skip to content
Snippets Groups Projects
Commit 76b2882a authored by catch's avatar catch
Browse files

Issue #1295546 by c31ck, marcingy, xjm, amateescu: Fixed Weight and number of...

Issue #1295546 by c31ck, marcingy, xjm, amateescu: Fixed Weight and number of votes not getting saved when updating a poll.
parent f15bc6f4
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -582,8 +582,10 @@ function poll_update($node) {
'weight' => $choice['weight'],
))
->insertFields(array(
'nid' => $node->nid,
'chtext' => $choice['chtext'],
'nid' => $node->nid,
'chtext' => $choice['chtext'],
'chvotes' => (int) $choice['chvotes'],
'weight' => $choice['weight'],
))
->execute();
}
......
......@@ -205,11 +205,12 @@ class PollCreateTestCase extends PollTestCase {
$new_option = $this->randomName();
$vote_count = '2000';
$node->choice[] = array(
'chid' => '',
'chtext' => $new_option,
'chvotes' => 0,
'weight' => 0,
'chvotes' => (int) $vote_count,
'weight' => 1000,
);
node_save($node);
......@@ -217,6 +218,12 @@ class PollCreateTestCase extends PollTestCase {
$this->drupalGet('poll');
$this->clickLink($title);
$this->assertText($new_option, 'New option found.');
$option = $this->xpath('//div[@id="node-1"]//div[@class="poll"]//div[@class="text"]');
$this->assertEqual(end($option), $new_option, 'Last item is equal to new option.');
$votes = $this->xpath('//div[@id="node-1"]//div[@class="poll"]//div[@class="percent"]');
$this->assertTrue(strpos(end($votes), $vote_count) > 0, t("Votes saved."));
}
function testPollClose() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment